Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var swatches = {
- swatchesArray: ['blue', 'pink', 'green', 'yellow', 'purple', 'orange', 'dark'],
- pageClass: '.netoPage',
- styles: function(){
- return `
- /* Blue */
- .netoPage.blue #netoToolbar {
- background-color: #083E52;
- border-bottom: solid 1px #083E52;
- }
- .netoPage.blue .netoToolbar--search {
- background-color: #0a4c65;
- }
- /* Pink */
- .netoPage.pink #netoToolbar {
- background-color: #BC1F56;
- border-bottom: solid 1px #BC1F56;
- }
- .netoPage.pink #netoToolbar .netoToolbar--search {
- background-color: #EF4A7E;
- }
- /* Green */
- .netoPage.green #netoToolbar {
- background-color: #56C1A8;
- border-bottom: solid 1px #56C1A8;
- }
- .netoPage.green #netoToolbar .netoToolbar--search {
- background-color: #2A9D83;
- }
- /* Yellow */
- .netoPage.yellow #netoToolbar {
- background-color: #E1AA25;
- border-bottom: solid 1px #E1AA25;
- }
- .netoPage.yellow #netoToolbar .netoToolbar--search {
- background-color: #FFC907;
- }
- /* Purple */
- .netoPage.purple #netoToolbar {
- background-color: #622B7C;
- border-bottom: solid 1px #622B7C;
- }
- .netoPage.purple #netoToolbar .netoToolbar--search {
- background-color: #A769AB;
- }
- /* Orange */
- .netoPage.orange #netoToolbar {
- background-color: #EC8623;
- border-bottom: solid 1px #EC8623;
- }
- .netoPage.orange #netoToolbar .netoToolbar--search {
- background-color: #FBB042;
- }
- /* Dark */
- .netoPage.dark #netoToolbar {
- background-color: #383D3F;
- border-bottom: solid 1px #383D3F;
- }
- .netoPage.dark #netoToolbar .netoToolbar--search {
- background-color: #86898A;
- }
- `;
- },
- inject: function(){
- var styleSheet = swatches.styles();
- var content = `<style>${styleSheet}</style>`;
- $('head').append(content);
- },
- switch: function(colour, time = 3000){
- if(colour){
- $.each(swatches.swatchesArray, function(i, v){
- $(swatches.pageClass).removeClass(v);
- });
- $(swatches.pageClass).addClass(colour);
- }else{
- var i = 0;
- window.setInterval(function(){
- if (i < swatches.swatchesArray.length - 1){
- i = i + 1;
- } else {
- i = 0;
- }
- $.each(swatches.swatchesArray, function(i, v){
- $(swatches.pageClass).removeClass(v);
- });
- $(swatches.pageClass).addClass(swatches.swatchesArray[i]);
- }, time);
- }
- },
- init: function(){
- swatches.inject();
- swatches.switch('dark');
- }
- }
- swatches.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement