How to make a specific color text semi transparent [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

How to make a specific color text semi transparent [SOLVED]

Post by Logansfury »

Hello,

I found a nice conky clock that presents the time in words rather than numbers:

Image

I have the colors and font edited to match my GUI, but the white letters are glaring. I would like to set them to 80% transparency. Here is the config section:

Code: Select all

conky.config = {
    background=false,
    own_window=true,
    own_window_type="normal",
    own_window_class="Conky",
    own_window_hints="undecorated,below,sticky,skip_taskbar,skip_pager",
	xinerama_head = 3,
    alignment="top_right",
    gap_x=40,
    gap_y=0,
    font = 'Neon 80s',
    use_xft=true,
    xftalpha=0.1,
    update_interval=1,
    uppercase=true,
    double_buffer=true,
    own_window_argb_visual=true,
    own_window_argb_value=0,
    draw_shades=true,
    default_color="ff0000",
    color1="ffffff"
}
I would like color1 (ffffff white) to always be 80% transparent, and the red text to be zero transparent.

How would I edit this to do that please?

Thank you for reading,

Logan
Last edited by Logansfury on Fri Mar 22, 2024 7:38 pm, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
spamegg
Level 14
Level 14
Posts: 5117
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: How to make a specific color text semi transparent

Post by spamegg »

I don't know what kind of syntax is used in this config file, but for transparency, you can try "rgba":

Code: Select all

rgba(255,255,255,0.8)
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: How to make a specific color text semi transparent

Post by Logansfury »

spamegg wrote: Fri Mar 22, 2024 6:20 pm I don't know what kind of syntax is used in this config file, but for transparency, you can try "rgba":

Code: Select all

rgba(255,255,255,0.8)
Hello Spam,

The language is conky's own syntax, but it recognizes bash script. I looked thru the manual but the color section was vague and there was no entry for an rgb or rgba command.

I've tried several ways but no luck, I'm getting the purple text that conky defaults to when given bad color code for text.

Code: Select all

${color #ffffff;80} Test Text
${color #ffffff80} Test Text
${color #ffffff 80} Test Text
${color #ffffff,80} Test Text
${color '#ffffff;80'} Test Text
${color '#ffffff80'} Test Text
${color '#ffffff 80'} Test Text
${color '#ffffff,80'} Test Text
At this point im just guessing at syntax and hoping for a miracle. I did go into the word-clock conky and changed the white to a medium-grey and it's no longer so bright and glaring seeming.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: How to make a specific color text semi transparent

Post by Koentje »

Logansfury wrote: Wed Mar 13, 2024 9:20 am Hello,

I found a nice conky clock that presents the time in words rather than numbers:

Image

I have the colors and font edited to match my GUI, but the white letters are glaring. I would like to set them to 80% transparency. Here is the config section:

Code: Select all

conky.config = {
    background=false,
    own_window=true,
    own_window_type="normal",
    own_window_class="Conky",
    own_window_hints="undecorated,below,sticky,skip_taskbar,skip_pager",
	xinerama_head = 3,
    alignment="top_right",
    gap_x=40,
    gap_y=0,
    font = 'Neon 80s',
    use_xft=true,
    xftalpha=0.1,
    update_interval=1,
    uppercase=true,
    double_buffer=true,
    own_window_argb_visual=true,
    own_window_argb_value=0,
    draw_shades=true,
    default_color="ff0000",
    color1="ffffff"
}
I would like color1 (ffffff white) to always be 80% transparent, and the red text to be zero transparent.

How would I edit this to do that please?

Thank you for reading,

Logan
AGAIN, without the complete files you are working with, how do you expect us to help you?
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: How to make a specific color text semi transparent

Post by Logansfury »

Koentje wrote: Fri Mar 22, 2024 7:10 pm
Logansfury wrote: Wed Mar 13, 2024 9:20 am Hello,

I found a nice conky clock that presents the time in words rather than numbers:

Image

I have the colors and font edited to match my GUI, but the white letters are glaring. I would like to set them to 80% transparency. Here is the config section:

Code: Select all

conky.config = {
    background=false,
    own_window=true,
    own_window_type="normal",
    own_window_class="Conky",
    own_window_hints="undecorated,below,sticky,skip_taskbar,skip_pager",
	xinerama_head = 3,
    alignment="top_right",
    gap_x=40,
    gap_y=0,
    font = 'Neon 80s',
    use_xft=true,
    xftalpha=0.1,
    update_interval=1,
    uppercase=true,
    double_buffer=true,
    own_window_argb_visual=true,
    own_window_argb_value=0,
    draw_shades=true,
    default_color="ff0000",
    color1="ffffff"
}
I would like color1 (ffffff white) to always be 80% transparent, and the red text to be zero transparent.

How would I edit this to do that please?

Thank you for reading,

Logan
AGAIN, without the complete files you are working with, how do you expect us to help you?
I didnt think the text layout would be relevant. There is only the conkyrc file producing this

Code: Select all

conky.config = {
    alignment="top_right",
    gap_x=24,
    gap_y=0,
    background=false,
    own_window=true,
    own_window_type="desktop",
    own_window_class="Conky",
    own_window_hints="undecorated,below,sticky,skip_taskbar,skip_pager",
	xinerama_head = 3,

    font="Neon 80s:size=18",
    use_xft=true,
    xftalpha=0.1,
    update_interval=1,
    uppercase=true,
    double_buffer=true,
    own_window_argb_visual=true,
    own_window_argb_value=0,
    draw_shades=true,
    default_color = '#ff0000',
    color1 = '#808080',

    border_width = 1,
    default_outline_color = 'black',
    default_shade_color = '#989fa7',
    double_buffer = true,
    draw_borders = false,
    draw_outline = true,
    draw_shades = false,
    extra_newline = false,

}

conky.text = [[
    
${alignc}${color}I T ${color1}L ${color}I S ${color1}A S T H P M A
${alignc}${if_match ${exec date +"%M"} < 35}${if_match ${exec date +"%M"} >= 15}${if_match ${exec date +"%M"} < 20}${color}${endif}${endif}A ${color1}C ${if_match ${exec date +"%M"} >= 15}${if_match ${exec date +"%M"} < 20}${color}${endif}${endif}Q U A R T E R ${color1}D C
${alignc}${if_match ${exec date +"%M"} >= 20}${if_match ${exec date +"%M"} < 30}${color}${endif}${endif}T W E N T Y ${if_match ${exec date +"%M"} >= 25}${if_match ${exec date +"%M"} < 30}${color}${endif}${else}${color1}${endif}${if_match ${exec date +"%M"} >= 5}${if_match ${exec date +"%M"} < 10}${color}${endif}${endif}F I V E ${color1}X
${alignc}${if_match ${exec date +"%M"} >= 30}${if_match ${exec date +"%M"} < 35}${color}${endif}${endif}H A L F ${color1}B ${if_match ${exec date +"%M"} >= 10}${if_match ${exec date +"%M"} < 15}${color}${endif}${endif}T E N ${color1}F T O
${alignc}${else}${if_match ${exec date +"%M"} >= 45}${if_match ${exec date +"%M"} < 50}${color}${endif}${endif}A ${color1}C ${if_match ${exec date +"%M"} >= 45}${if_match ${exec date +"%M"} < 50}${color}${endif}${endif}Q U A R T E R ${color1}D C
${alignc}${if_match ${exec date +"%M"} >= 35}${if_match ${exec date +"%M"} < 45}${color}${endif}${endif}T W E N T Y ${if_match ${exec date +"%M"} < 40}${if_match ${exec date +"%M"} >= 35}${color}${endif}${else}${color1}${endif}${if_match ${exec date +"%M"} >= 55}${color}${endif}F I V E ${color1}X
${alignc}H A L F B ${if_match ${exec date +"%M"} >= 50}${if_match ${exec date +"%M"} < 55}${color}${endif}${endif}T E N ${color1}F ${color}T O${color1}
${alignc}${endif}${if_match ${exec date +"%M"} < 35}${if_match ${exec date +"%M"} >= 5}${color}${endif}${endif}P A S T ${color1}E R U ${if_match ${exec date +"%M"} < 35}${if_match ${exec date +"%I"} == 9}${color}${else}${color1}${endif}N I N E
${alignc}${if_match ${exec date +"%I"} == 1}${color}${else}${color1}${endif}O N E ${if_match ${exec date +"%I"} == 6}${color}${else}${color1}${endif}S I X ${if_match ${exec date +"%I"} == 3}${color}${else}${color1}${endif}T H R E E
${alignc}${if_match ${exec date +"%I"} == 4}${color}${else}${color1}${endif}F O U R ${if_match ${exec date +"%I"} == 5}${color}${else}${color1}${endif}F I V E ${if_match ${exec date +"%I"} == 2}${color}${else}${color1}${endif}T W O
${alignc}${if_match ${exec date +"%I"} == 8}${color}${else}${color1}${endif}E I G H T ${if_match ${exec date +"%I"} == 11}${color}${else}${color1}${endif}E L E V E N
${alignc}${if_match ${exec date +"%I"} == 7}${color}${else}${color1}${endif}S E V E N ${if_match ${exec date +"%I"} == 12}${color}${else}${color1}${endif}T W E L V E
${alignc}${if_match ${exec date +"%I"} == 10}${color}${else}${color1}${endif}T E N ${else}${if_match ${exec date +"%I"} == 8}${color}${else}${color1}${endif}N I N E
${alignc}${if_match ${exec date +"%I"} == 12}${color}${else}${color1}${endif}O N E ${if_match ${exec date +"%I"} == 5}${color}${else}${color1}${endif}S I X ${if_match ${exec date +"%I"} == 2}${color}${else}${color1}${endif}T H R E E
${alignc}${if_match ${exec date +"%I"} == 3}${color}${else}${color1}${endif}F O U R ${if_match ${exec date +"%I"} == 4}${color}${else}${color1}${endif}F I V E ${if_match ${exec date +"%I"} == 1}${color}${else}${color1}${endif}T W O
${alignc}${if_match ${exec date +"%I"} == 7}${color}${else}${color1}${endif}E I G H T${if_match ${exec date +"%I"} == 10}${color}${else}${color1}${endif} E L E V E N
${alignc}${if_match ${exec date +"%I"} == 6}${color}${else}${color1}${endif}S E V E N${if_match ${exec date +"%I"} == 11}${color}${else}${color1}${endif} T W E L V E
${alignc}${if_match ${exec date +"%I"} == 9}${color}${else}${color1}${endif}T E N ${endif}${color1}S E ${if_match ${exec date +"%M"} < 5}${color}${endif}O' C L O C K
# ${alignc}${color}${time %p}
# ${alignc}${if_match "${time %p}" == "AM"}${color}A M${else}${color1}A M${endif} ${if_match "${time %p}" == "PM"}${color}P M${else}${color1}P M${endif}
${alignc}${if_match "${time %p}" == "AM"}${color}A M${color1} R S T N Q Z I ${else}${color1}A M R S T N Q Z I ${endif} ${if_match "${time %p}" == "PM"}${color}P M${else}${color1}P M${endif}
]];
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: How to make a specific color text semi transparent

Post by Koentje »

Logansfury wrote: Fri Mar 22, 2024 7:14 pm I didnt think the text layout would be relevant. There is only the conkyrc file producing this..
Why would you think that? How can we test it on our systems without the complete script? Do you think that by just looking at, will fix it?

xftalpha=0.1, is the part that makes it transparent, but from what i understand is that you ONLY want the white characters more transparent and not the red ones? That's not possible, only with a LUA script.
So making the white font grey is maybe the best solution.
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: How to make a specific color text semi transparent

Post by Logansfury »

Koentje wrote: Fri Mar 22, 2024 7:22 pm xftalpha=0.1, is the part that makes it transparent, but from what i understand is that you ONLY want the white characters more transparent and not the red ones? That's not possible, only with a LUA script.
So making the white font grey is maybe the best solution.
Yes I was hoping to make white semi-transparent while keeping red solid at 0 transparency.

I was afraid that might not be possible, but thought perhaps there was a way to format the ${color} command to call transparency for a selected section of text.

The grey I selected is very mild to the eyes so I can forgo the hopes of transparency and still love this conky.

I know nothing of .lua script but I will see if online resources can generate one to test.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2838
Joined: Wed Oct 19, 2016 6:08 pm

Re: How to make a specific color text semi transparent

Post by zcot »

Logansfury wrote: Fri Mar 22, 2024 6:53 pm
im just guessing at syntax and hoping for a miracle.
that's not a great idea. you waste your time:
https://github.com/brndnmtthws/conky/wi ... s#settings
https://github.com/brndnmtthws/conky/wi ... #variables
you can do it: man conky > ~/.conky/THEconkymanual
the exact precise data is there, and for the exact version you are running, not one that was documented on some random website 8 years ago.

the answer is no.

but you can do it if you break that config into 2 portions and fire the red on one config and the white, with transparency, on the other. That's the only sane resolution for exactly what you are asking for. The solution is only considering for further overload of your system. My recommendation is either make the one config with all transparency, or make the one config with a slightly off-white color.

For efficiency, actually implementing a bash feature generally does better than the processing the complexity inside the conky system. That config is overbloated with the processing. It does all these things and then eventually uses a bash type of end result anyway. If you do it in a more convoluted way with bash then you're eliminating the middle man. That config calls the exact same exec 15 or 20 times in a row immediately and keeps processing for different things, where with bash you can call once and do some processing and get the same results. The difference is big in the end. Also, using the same comparison using lua from conky is notably not as efficient.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: How to make a specific color text semi transparent

Post by Logansfury »

zcot wrote: Fri Mar 22, 2024 11:06 pm
Logansfury wrote: Fri Mar 22, 2024 6:53 pm
im just guessing at syntax and hoping for a miracle.
that's not a great idea. you waste your time:
https://github.com/brndnmtthws/conky/wi ... s#settings
https://github.com/brndnmtthws/conky/wi ... #variables
you can do it: man conky > ~/.conky/THEconkymanual
the exact precise data is there, and for the exact version you are running, not one that was documented on some random website 8 years ago.

the answer is no.

but you can do it if you break that config into 2 portions and fire the red on one config and the white, with transparency, on the other. That's the only sane resolution for exactly what you are asking for. The solution is only considering for further overload of your system. My recommendation is either make the one config with all transparency, or make the one config with a slightly off-white color.

For efficiency, actually implementing a bash feature generally does better than the processing the complexity inside the conky system. That config is overbloated with the processing. It does all these things and then eventually uses a bash type of end result anyway. If you do it in a more convoluted way with bash then you're eliminating the middle man. That config calls the exact same exec 15 or 20 times in a row immediately and keeps processing for different things, where with bash you can call once and do some processing and get the same results. The difference is big in the end. Also, using the same comparison using lua from conky is notably not as efficient.
Thank you for the reply :)

The script changes the colors of text based on time, so most of the letters making up the block of text would be transparent and then 5 minutes later have to be red or vice versa. I think this text coloration is too dynamic in this particular conky for a second .conf of transparent letters to work.

I doesn't look bad at all with the glaring white toned down to medium grey and it's a particularly cool conky for me to have as I actually own one of the real-life Sharper Image word clocks this conky is based on.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”