提交 5e41f41a 编写于 作者: G Gabriele Cirulli

generate tile colors automatically

上级 e3a548bd
...@@ -45,6 +45,12 @@ ...@@ -45,6 +45,12 @@
<div class="tile tile-4 tile-position-2-3"> <div class="tile tile-4 tile-position-2-3">
4 4
</div> </div>
<div class="tile tile-512 tile-position-3-2">
512
</div>
<div class="tile tile-2048 tile-position-4-4">
2048
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -129,3 +129,30 @@ h1 { ...@@ -129,3 +129,30 @@ h1 {
position: absolute; position: absolute;
left: 363.75px; left: 363.75px;
top: 363.75px; } top: 363.75px; }
.tile.tile-2 {
background: #eee4da; }
.tile.tile-4 {
background: #ede0ca; }
.tile.tile-8 {
background: #edddba; }
.tile.tile-16 {
background: #eddaab; }
.tile.tile-32 {
background: #edd79b; }
.tile.tile-64 {
background: #edd48b; }
.tile.tile-128 {
background: #edd17c;
font-size: 45px; }
.tile.tile-256 {
background: #edce6c;
font-size: 45px; }
.tile.tile-512 {
background: #edcb5c;
font-size: 45px; }
.tile.tile-1024 {
background: #edc84d;
font-size: 35px; }
.tile.tile-2048 {
background: #edc53d;
font-size: 35px; }
@import "helpers";
@import "fonts/clear-sans.css"; @import "fonts/clear-sans.css";
$field-width: 500px; $field-width: 500px;
...@@ -7,6 +8,7 @@ $tile-size: ($field-width - $grid-spacing * ($grid-row-cells + 1)) / $grid-row-c ...@@ -7,6 +8,7 @@ $tile-size: ($field-width - $grid-spacing * ($grid-row-cells + 1)) / $grid-row-c
$tile-border-radius: 3px; $tile-border-radius: 3px;
$tile-color: #eee4da; $tile-color: #eee4da;
$tile-gold-color: #edc22e;
html, body { html, body {
margin: 0; margin: 0;
...@@ -104,6 +106,27 @@ h1 { ...@@ -104,6 +106,27 @@ h1 {
} }
} }
} }
$base: 2;
$exponent: 1;
$limit: 11;
@while $exponent <= $limit {
$power: pow($base, $exponent);
$percent: (($exponent - 1) / $limit) * 100;
&.tile-#{$power} {
background: mix($tile-gold-color, $tile-color, $percent);
@if $power >= 100 and $power < 1000 {
font-size: 45px;
} @else if $power >= 1000 {
font-size: 35px;
}
}
$exponent: $exponent + 1;
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册