Skip to content

Instantly share code, notes, and snippets.

@jaychsu
Last active July 17, 2017 17:52
Show Gist options
  • Save jaychsu/1d0f0b55030eba40a1fda3544691050b to your computer and use it in GitHub Desktop.
Save jaychsu/1d0f0b55030eba40a1fda3544691050b to your computer and use it in GitHub Desktop.
generate colorful class in `LESS` by given color set
@color-class-prefix: chosen-color-;
@color-list:
#ffc4c6,
#fdeddf,
#fff6c3,
#cdffbe,
#bdf7ef,
#cce7fb,
#dacefc,
#fbc9f1,
#e7c9b7,
#ffffff,
#f07275,
#fcd4b1,
#f9e596,
#90faa9,
#7bf7e6,
#99cbef,
#bba6f7,
#f89de6,
#c39a82,
#e2e2e2,
#f74444,
#fcb867,
#ffe169,
#51e399,
#3be0ca,
#61b0e8,
#a07be4,
#ef68d4,
#9a6e58,
#afafaf,
#d80b10,
#ff8a00,
#ffcc00,
#0dc77f,
#28c7c1,
#02a0e2,
#8056cd,
#f435b3,
#7f3c27,
#6e6e6e,
#9f0b0e,
#df6901,
#daaf02,
#0f9561,
#24a29e,
#0d7aa7,
#592fa5,
#be1584,
#5a3225,
#000000,
#812f30,
#b86b28,
#ba9c22,
#2d795c,
#2b8582,
#2e6e88,
#503a79,
#913b73,
#4c342c,
#2b2b2a,
#613e3f,
#8e643f,
#8d7f47,
#4a7564,
#4c7775,
#47707d,
#564a6c,
#754f68,
#493f3c,
#3a3a3a;
.class-generator (@i) when (@i < length(@color-list)) {
.@{color-class-prefix}@{i} {
background-color: extract(@color-list, @i + 1) !important;
}
.class-generator(@i + 1);
}
.class-generator(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment