Created
April 17, 2013 11:18
-
-
Save nsisodiya/5403513 to your computer and use it in GitHub Desktop.
Manage Theme with SASS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$boxwidth: 300px; | |
$boxheight: 200px; | |
$boxbackgroundcolor: #456343; | |
$whiteFontColor:#E3E1E1; | |
$bigFontsSize: 30px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$boxwidth: 400px; | |
$boxheight: 150px; | |
$boxbackgroundcolor: #151383; | |
$whiteFontColor:#E3E167; | |
$bigFontsSize: 15px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html id="root" class="theme1"> | |
<head> | |
<script> | |
function changetheme(){ | |
var html = document.getElementById("root"); | |
if(html.getAttribute("class") === "theme1"){ | |
html.setAttribute("class", "theme2") | |
}else{ | |
html.setAttribute("class", "theme1") | |
}; | |
} | |
</script> | |
<link href="./stylesheets/theme/main.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> | |
<input type="button" value="changetheme" onClick="changetheme()"> | |
<div class="box">This is Hello World</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin box { | |
width: $boxwidth; | |
height: $boxheight; | |
background: { | |
color: $boxbackgroundcolor; | |
}; | |
font: { | |
size: $bigFontsSize; | |
}; | |
color: $whiteFontColor; | |
} | |
@import "color1.scss"; | |
html.theme1 .box { | |
@include box; | |
} | |
@import "color2.scss"; | |
html.theme2 .box { | |
@include box; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment