Working with RGBa colors

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Working with RGBa colors

Post by husky » 25 Nov 2017 15:57

Hello,


I'd like to someone else than Martin to answer my question.

I say this because I know Martin is busy with the accessibility BS thrown on his lap.
I'd like to spare him and let him do what he needs to do solve the Accssb. issue.
Question: Concerning RBGA.

I already read Desmanto's explanation regarding RBGA conversion from Dec to Hex and vice-versa.

What I'd like to now if there is any way to access a color presented in a screen as result of a ControlUI.

Example: I have in my Settings a field in the screen that changes from color A to color B depending on the option I select.

In my case when I select an option, the field in the screen that had white background, changes to gray.
Upon selecting the gray background option, it will automatically change to white.

That's something controlled by the Settings in the phone/tablet I suppose.


Is there a way to detect on the screen, what is the color code of the background at any given moment using the RBGA functions of Automagic?


Thank You

Husky
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Working with RGBa colors

Post by Desmanto » 25 Nov 2017 16:49

I actually wanna do it also when troubleshooting search's text color bug introduced in previous EAP. There is not direct method to do it.
I ended taking screenshot, init the image and use get color to get the value.
Not practical if you need to do it interactively. Since taking screenshot, save it, load it up again will take a while to finish.

If the option toggled, probably it is a checkbox element. If so, you can use Control UI, overlay to detect the element name and act base upon it.
To loop checking the element while you are at that screen, you can use UI Event - window opened, coupled with Control UI, where you put while() to loop checking the checkbox toggle.
Look on how to detect current opened window, viewtopic.php?f=6&t=6894
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Re: Working with RGBa colors

Post by husky » 25 Nov 2017 18:41

Hi Desmanto,

Yes, i suspeccted the answer woudn't be a trivial one. The screenshot evetually pays off for debugging purposes but it's really too much work in 10-20 step flow with no need to debug anything.

The detection of element name might work but I don't see how to apply the color function in order to get the colors. The Manual doesn't bring any example.

I'll use the example in your posting as a guide. I just have to figure out how to adapt it( assuming it has an element name)

Let you know later on.

Best Regards

Husky
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Re: Working with RGBa colors

Post by husky » 16 Dec 2017 23:04

Hello,

I guess the dust has settled down a bit so here goes another DUH! question.

It is related to colors and it had me wondering since I started with automagic.

When checking the color code at W3School standards:

for the red color #FFFF00 (255,255,0) is enough.

In the automagic color world the above color results in YELLOW instead of RED.
In order to obtain the red color I need to add 00 thus giving me #FFFF0000. (255,255,0,0)

Question: What color code is being used by automagic that needs an extra hex value to give me the color I need?


Pretty DUH! question but I was not able to locate any such standard in W3School. May be an European standard?

Thank You

Husky
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
Bingwu
Posts: 114
Joined: 26 Feb 2016 10:26

Re: Working with RGBa colors

Post by Bingwu » 16 Dec 2017 23:19

Hello Husky!

Automagig uses (for widgets) (Alpha, Red, Green, Blue), therefore (255,255,0,0) or #FFFF0000 for red.

Regards
Peter (No. 2)

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Re: Working with RGBa colors

Post by husky » 18 Dec 2017 00:14

Hi Peter,

Thanks for the reply.

The closest I found in W3School is the "CMYK Calculator" (https://www.w3schools.com/colors/colors_cmyk.asp) but
the the alpha does not match cmyk(100%, 0%, 0%, 0%).

I suspected that the C part of it would be the something akin to alpha but the hex doesn't match.
I guess I'll drop my quest for color interpretation. :)

Best Regards

Husky
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Working with RGBa colors

Post by Desmanto » 18 Dec 2017 07:13

Nope CMYK is different subset. Alpha correspond to the opacity (or transparency). The format for automagic color is argb. While most of the color picker out there only pick for rgb. Some may give you rgba, but the a (alpha) in decimal point between 0,00 - 1,00). To get the proper hex value, you have to multiply it by 255, round it to the nearest integer and convert it to hex. And alpha should be in the first 2 bytes. If you don't want to control the transparency, just put FF in the first 2 bytes. It means full opaque (completely solid color, not transparent).

So you can you use any color picker using rgb. After you get 6 hex for the rgb part, append #FF for the alpha channel. That it the code you need.

But if you really need a very simple tool just to get the job done, there is ARGB to HEX in playstore : https://play.google.com/store/apps/deta ... n.khp.argb
It is a one trick pony app, only for color picking to argb hex format. But hey it works, apk only 120 KB, no permission. You can even enhanced the app by using UI event - component clicked to copy the hex code. I was thinking to create a flow to show color picker to hex format. But I probably better save my time for another flow. Since this app footprint is very small to bother.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Re: Working with RGBa colors

Post by husky » 19 Dec 2017 15:02

Hi there Desmanto,

Nice explanation. I guess argb is used by Mac (Apple).

Martin once told me he uses Mac instead of windows and I only use the crappy windows 10 that are being thrown at you for free till Dec 31.

I was reading an article about the Win 10 and it just scares the bejesus out of me. It's being shoved down our throat with all kind of bugs. They even apply patches AND install new versions of Win 10 at the SAME DAMN TIME without you knowing it.

SCAAAARY!!!!!!

I'll check the link in play store.

If we don't speak again till next "doomsday" January first, I wish you Happy Holidays and a Wonderful New Year, unless someone presses the damn Nuke Button first. The it is just a moot-poin.


Best Regards

Husky
"Basic research is what I'm doing when I don't know what I'm doing"

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Working with RGBa colors

Post by Martin » 20 Dec 2017 10:53

BTW: I'm usually only using Linux since it can run all required tools I need (I have a virtual machine with an old Windows version in case I have to use a Windows only tool which happens very rarely, maybe once a year to test some Windows only FTP servers).

Regards,
Martin

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Re: Working with RGBa colors

Post by husky » 20 Dec 2017 21:05

Martin,


OOOOPs!!

My bad. My memory is playing tricks again. I understood that you were working with Mac HW.

I guess my memory that used to be 64Gb is now, as I'm getting older, is just down to couple of Mb. Soon will be decaying to the byte level. :D ARGGH!!!



Anyway, thanks for the correction.


Take care

husky
"Basic research is what I'm doing when I don't know what I'm doing"

Post Reply