MTMR icon indicating copy to clipboard operation
MTMR copied to clipboard

Is there any way to change color of buttons

Open hobo313 opened this issue 5 years ago • 5 comments

Hi,

Wondering if there is anyway to change the color of the buttons and or text within certain elements? I know it is possible to change the color of the boarders, but is there a way to change just the color of the actual button? And if so, could someone please provide me with a sample code? (Very new to coding)

Thank you!

hobo313 avatar May 01 '20 08:05 hobo313

Any help?

hobo313 avatar May 03 '20 01:05 hobo313

@hobo313 atm there're two possibilities: in description there https://github.com/Toxblh/MTMR check for "background" and "shellScriptTitledButton".

bobrosoft avatar May 04 '20 18:05 bobrosoft

@bobrosoft Thank you. I have seen the option to change the color for the background, but I would like to change the input source (I apologize if I am not using the proper terminology, still new to coding). The example under "shellScriptTitledButton" is for the button to change colors based on certain load values. I would like to change the color of the text displayed in my date button to black so that when I change the background color to white, the text is still visible. I would appreciate if anyone has any information on this.

hobo313 avatar May 04 '20 18:05 hobo313

Certain elements, such as the pause/play button, change colors according to the background color you sign. but the time button does not. I was hoping for a fix.

hobo313 avatar May 04 '20 19:05 hobo313

you mean like this?

{
    "type": "shellScriptTitledButton",
    "refreshInterval": 1,
    "align": "right",
    "source": {
        "inline": "STATE=$(cat state.txt); [ $STATE == \"working\" ] && echo -e \"\\033[30;42mworking\" || echo -e \"\\033[30;41mnot working\""
    }
  }

if the file contains the word "working" it will display "working" with green background, if not it will display "not working" with a red background. the state.txt file is just an example, you could get the value you want to check from anywhere with command substitution. i.e. STATE=$(echo TeSt) and then STATE will contain TeSt or let's say you want the PID of your FireFox then you could use STATE=$(pgrep firefox). using more complex if elseif and so on seems to be iffy which is why I had to resort to the classic && and || approach instead. What you could do as a workaround there is use command substitution to run a script somewhere that returns the colour and text you want.

fr4nk3n5731n avatar Jun 08 '20 07:06 fr4nk3n5731n