mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 15:17:47 +00:00
Fix 256 colour example (#175)
* Fix 256 colour example * Fix 256 colour example
This commit is contained in:
parent
400b985671
commit
5012cb44a3
1 changed files with 3 additions and 9 deletions
|
@ -20,12 +20,6 @@ def contrast_colour [ colour:int ] {
|
||||||
let g = (($colour - 16) mod 36) / 6
|
let g = (($colour - 16) mod 36) / 6
|
||||||
let b = ($colour - 16) mod 6
|
let b = ($colour - 16) mod 6
|
||||||
|
|
||||||
# if $g > 2 {
|
|
||||||
# 0
|
|
||||||
# } {
|
|
||||||
# 15
|
|
||||||
# }
|
|
||||||
|
|
||||||
let luminance = ($r * 299) + ($g * 587) + ($b * 114)
|
let luminance = ($r * 299) + ($g * 587) + ($b * 114)
|
||||||
if $luminance > 2500 {
|
if $luminance > 2500 {
|
||||||
0
|
0
|
||||||
|
@ -65,11 +59,11 @@ def print_blocks [start:int, end:int, block-cols:int, block-rows:int, blocks-per
|
||||||
print_run ($start + $block * $block-length + $row * $block-cols + $i * $block-length * $blocks-per-line) $block-cols
|
print_run ($start + $block * $block-length + $row * $block-cols + $i * $block-length * $blocks-per-line) $block-cols
|
||||||
} | append (char nl) | str collect
|
} | append (char nl) | str collect
|
||||||
} | str collect
|
} | str collect
|
||||||
# char nl
|
|
||||||
} | str collect
|
} | str collect
|
||||||
}
|
}
|
||||||
|
|
||||||
print_run 0 16 # The first 16 colours are spread over the whole spectrum
|
print_run 0 16 # The first 16 colours are spread over the whole spectrum
|
||||||
char nl
|
print "" # Single line
|
||||||
print_blocks 16 231 6 6 3 # 6x6x6 colour cube between 16 and 231 inclusive
|
print_blocks 16 123 6 6 3 # 6x6x6 colour cube between 16 and 123 inclusive
|
||||||
|
print_blocks 124 231 6 6 3 # 6x6x6 colour cube between 124 and 231 inclusive
|
||||||
print_blocks 232 255 12 2 1 # Not 50, but 24 Shades of Grey
|
print_blocks 232 255 12 2 1 # Not 50, but 24 Shades of Grey
|
Loading…
Add table
Add a link
Reference in a new issue