From 4e8a59668535badfe7e1975f52fb04489e467585 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 3 Nov 2021 20:20:07 +0530 Subject: Parse fornax format to generate the images Switched to PNG because SVGs were larger in this case. Also, video will be created with `ffmpeg` so it's just easier to use PNGs. --- lib/Fornax/Hex2RGB.rakumod | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/Fornax/Hex2RGB.rakumod (limited to 'lib/Fornax/Hex2RGB.rakumod') diff --git a/lib/Fornax/Hex2RGB.rakumod b/lib/Fornax/Hex2RGB.rakumod new file mode 100644 index 0000000..aa77739 --- /dev/null +++ b/lib/Fornax/Hex2RGB.rakumod @@ -0,0 +1,8 @@ +#| 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 +} -- cgit 1.4.1-2-gfad0