User:Schen13/WikiColor.sass

Code
// databases $volume-colors: ( seven-magicians: ( manga: (     1:#f28d01,      2:#db8bae,      3:#a97db2,      4:#48a7df,      5:#00a67e,      6:#a1c91b,      7:#ffc900,      8:#fbb102,      9:#f499a7,      10:#977bb7,      11:#54c1e8,      12:#00a692,      13:#83df56,      14:#fffa1c,      15:#fe8d3d,      16:#ff9ed1,      17:#d8addb,      18:#52b3e0,      19:#0BB9C4,      20:#D7E401     ) ) );

$last-volumes: ( seven-magicians : ( manga: (     japan: 20    ), light-novel: (     japan: 3    ) ) );

$series-codes: ( seven-magicians: SM );

$media-codes: ( manga: MA );

@function volume-color($series, $media, $version) { $volume-color: white; @if (map-has-key($volume-colors, $series)) { $series-media: map-get($volume-colors, $series);

@if (map-has-key($series-media, $media)) { $volumes: map-get($series-media, $media); @if (map-has-key($volumes, $version)) { $volume-color: map-get($volumes, $version); }   }  }  @return $volume-color; }

$character-colors: ( Lilith: volume-color(seven-magicians, manga, 1),  Arin: volume-color(seven-magicians, manga, 2),  Levi: volume-color(seven-magicians, manga, 3),  Lieselotte: volume-color(seven-magicians, manga, 4),  Mira: volume-color(seven-magicians, manga, 5),  Yui: volume-color(seven-magicians, manga, 6),  Akio: volume-color(seven-magicians, manga, 7),  Sora: volume-color(seven-magicians, manga, 8),  Lugh: volume-color(seven-magicians, manga, 9),  Hijiri: volume-color(seven-magicians, manga, 10),  Anastasia-L: volume-color(seven-magicians, manga, 11),  Arsha: volume-color(seven-magicians, manga, 12),  Selina: volume-color(seven-magicians, manga, 13),  Ilia: volume-color(seven-magicians, manga, 14),  Judecca: volume-color(seven-magicians, manga, 15),  Rubine: volume-color(seven-magicians, manga, 16),  Lilim: volume-color(seven-magicians, manga, 17),  Mina: volume-color(seven-magicians, manga, 18), Libik: volume-color(seven-magicians, manga, 19), Ryuhime: volume-color(seven-magicians, manga, 20), );

@function last-volume($series, $media, $country) { $last-volume: 0; @if (map-has-key($last-volumes, $series)) { $media-country: map-get($last-volumes, $series); @if (map-has-key($media-country, $media)) { $country-volume: map-get($media-country, $media); @if (map-has-key($country-volume, $country)) { $last-volume: map-get($country-volume, $country); }   }  }  @return $last-volume; }

$last-volume-color: ( japan: volume-color(seven-magicians, manga, last-volume(seven-magicians, manga, japan)) );

$default-color: volume-color(seven-magicians, manga, last-volume(seven-magicians, manga, japan)); @debug "#{$default-color}";

@mixin base_border($color) { border: 3px solid $color; border-radius: 5px; }

@mixin front_color($back-color) { @if (lightness($back-color) > 40) { color: black; } }

.default { &-color { color: $default-color; } &-border { @include base_border($default-color); } &-bg-color { background-color: $default-color; @include front_color($default-color); } &-img-bg-color img { background-color: $default-color; } }

@each $series, $media-volume in $volume-colors { $series-code: map-get($series-codes, $series); @each $media, $volume-color in $media-volume { $media-code: map-get($media-codes, $media); @each $volume, $color in $volume-color { .#{$series-code} { &.#{$media-code} { &.v#{$volume} { &.v- { &border { @include base_border($color); }             &color { color: $color; }             &bg-color { background-color: $color; @include front_color($color); }             &img-bg-color img { background-color: $color; }           }          }        }      }    }  } }

.char- { $default: white; &color { color: white; @each $character, $color in $character-colors { &.#{$character} { color: $color; }     }  } }