about summary refs log tree commit diff stats
path: root/lib/Octans/Hex2RGB.rakumod
blob: 72cb84812772bc4bc3e087d827857a1edeb75f34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
# 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
}
pan> # This plugin serves as an example for adding key bindings through a plugin. # It could replace the ten lines in the rc.conf that create the key bindings # for the "chmod" command. from __future__ import (absolute_import, division, print_function) import ranger.api HOOK_INIT_OLD = ranger.api.hook_init def hook_init(fm): HOOK_INIT_OLD(fm) # Generate key bindings for the chmod command command = "map {0}{1}{2} shell -d chmod {1}{0}{2} %s" for mode in list('ugoa') + ['']: for perm in "rwxXst": fm.execute_console(command.format('-', mode, perm)) fm.execute_console(command.format('+', mode, perm)) ranger.api.hook_init = hook_init