generate tile colors automatically
This commit is contained in:
@@ -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 {
|
|||||||
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; }
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@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
|
|||||||
$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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user