Android Synapse – Dynamic Translation Layer Color

if [[ ! -z $2 ]]; then
    let "RC=($((16$2)) & 16711680) >> 16";
    let "GC=($((16$2)) & 65280) >> 8";
    let "BC=$((16$2)) & 255";
fi

case $1 in

scr_red)    ;&
scr_green)  ;&
scr_blue)   ;&
scr_yellow) ;&
scr_cyan)   ;&
scr_magenta)    ;&
scr_white)  ;&
scr_black)
    P=/sys/class/misc/mdnie/hook_control/

    if [[ ! -z $2 ]]; then
        echo $RC > $P/$1_red
        echo $GC > $P/$1_green
        echo $BC > $P/$1_blue
    fi

    echo $(printf "#%02X%02X%02X\n" $(cat $P/$1_red) $(cat $P/$1_green) $(cat $P/$1_blue))
    ;;
esac