Last active
December 21, 2017 18:13
-
-
Save Phryxe/ccdfe0a2e40ceb1a87492a6628555636 to your computer and use it in GitHub Desktop.
Red's Predefined Colors
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
Red [ | |
Needs: 'View | |
] | |
b-or-w?: func [color [tuple!] /local darkness [float!]] [ | |
darkness: 1 - (((0.299 * color/1) + (0.587 * color/2) + (0.114 * color/3)) / 255) | |
either (darkness < 0.5) [return black][return white] | |
] | |
size: 100x25 | |
blk: load help-string tuple! | |
sort/skip blk 2 | |
colors: parse blk [collect [some [keep word! | skip]]] | |
content: "" | |
repeat i length? colors [ | |
append content reduce ["base " (size) " " (colors/:i) " font-color " (b-or-w? do colors/:i) " " (rejoin [{"} colors/:i {"}]) " center middle" "^/"] | |
if (mod i 4) = 0 [append content reduce ["return" "^/"]] | |
] | |
view compose/deep [ | |
title "Red's Predefined Colors" | |
backdrop 123.123.103 | |
across | |
(load content) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment