GTK3 Issue: Unable to fetch color for disabled widget

Abhishek Kumar via desktop-devel-list <[email protected]> Mon, 26 Sep 2022 04:32:35 +0000
Newsgroups gmane.comp.gnome.desktop
Message-ID <MWHPR10MB1885CC147636209A5E419957CF529@MWHPR10MB1885.namprd10.prod.outlook.com>
--===============5042643345902250331==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_MWHPR10MB1885CC147636209A5E419957CF529MWHPR10MB1885namp_"

--_000_MWHPR10MB1885CC147636209A5E419957CF529MWHPR10MB1885namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hello,

I am facing an issue to read foreground color for insensitive widgets (e.g.=
 menubar, spinner etc.) in GTK 3.
I am trying to get the stylecontext for the widget by calling 'gtk_widget_g=
et_style_context' API and
then get the foreground color for insensitive state by calling 'gtk_style_c=
ontext_get_color' API.

The returned color value is having 0.2396 for red, green and blue component=
 which is wrong.

I am using Ubuntu 22.04 and theme is 'Yaru'.

Can anyone help me out what should be the correct approach to read color va=
lues from gtk css file?

Thanks
Abhishek




--_000_MWHPR10MB1885CC147636209A5E419957CF529MWHPR10MB1885namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-IN" link=3D"#0563C1" vlink=3D"#954F72" style=3D"word-wrap:=
break-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hello,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I am facing an issue to read foreground color for in=
sensitive widgets (e.g. menubar, spinner etc.) in GTK 3.<o:p></o:p></p>
<p class=3D"MsoNormal">I am trying to get the stylecontext for the widget b=
y calling &#8216;gtk_widget_get_style_context&#8217; API and
<o:p></o:p></p>
<p class=3D"MsoNormal">then get the foreground color for insensitive state =
by calling &#8216;gtk_style_context_get_color&#8217; API.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">The returned color value is having 0.2396 for red, g=
reen and blue component which is wrong.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I am using Ubuntu 22.04 and theme is &#8216;Yaru&#82=
17;.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Can anyone help me out what should be the correct ap=
proach to read color values from gtk css file?<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Thanks<o:p></o:p></p>
<p class=3D"MsoNormal">Abhishek<o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"background:white"><span style=3D"font-size:=
11.5pt;font-family:&quot;Courier New&quot;;color:#080808;mso-fareast-langua=
ge:EN-IN"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_MWHPR10MB1885CC147636209A5E419957CF529MWHPR10MB1885namp_--

--===============5042643345902250331==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
desktop-devel-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

--===============5042643345902250331==--