#!/bin/bash

runtime="${XDG_RUNTIME_DIR}/i3blocks"
[[ ! -d "$runtime" ]] && mkdir -p "$runtime"

if [[ -n "$button" ]]
then
	if [[ -f "$runtime/rgb" ]]
	then
		sudo msi-rgb 0 0 0 &>/dev/null
		rm "$runtime/rgb"
	else
		sudo msi-rgb FFFFFFFF 0 0 &>/dev/null
		touch "$runtime/rgb"
	fi
else
	sudo msi-rgb FFFFFFFF 0 0 &>/dev/null
	touch $runtime/rgb
fi

if [[ -f "$runtime/rgb" ]]
then
	color="#99CC99"
else
	color="#747369"
fi


echo "<span foreground=\"$color\">rgb</span>"