blob: 72cb84812772bc4bc3e087d827857a1edeb75f34 (
plain) (
tree)
|
|
# This module has been adapted from Fornax::Hex2RGB.
#| Takes hex value and returns RGB equivalent.
sub hex2rgb(Str $hex --> List) is export {
# Skip the first character, group each by 2 and parse as base 16.
# Divide by 255 to return value between 0, 1.
$hex.comb.skip.rotor(2).map(
*.join.parse-base(16) / 255
)>>.Rat
}
|