Re: GTK3 Issue: Unable to fetch color for disabled widget

Alexander Mikhaylenko via desktop-devel-list <[email protected]> Mon, 26 Sep 2022 09:03:59 +0400
Newsgroups gmane.comp.gnome.desktop
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============1813559391411456957==
Content-Type: multipart/alternative;
 boundary="------------9sfbBOFOTVJ00cw3oG4FrmM6"
Content-Language: en-US, en-BS

This is a multi-part message in MIME format.
--------------9sfbBOFOTVJ00cw3oG4FrmM6
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Not all insensitive widgets change their color. They can also, for 
example, change their opacity, or maybe one of their children changes 
color but not the widget itself. In general, trying to guess stuff like 
that from the theme is a fool's errand, just hardcode something or 
really use css yourself.

On 26/09/2022 08:32, Abhishek Kumar via desktop-devel-list wrote:
>
> 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_get_style_context’ API and
>
> then get the foreground color for insensitive state by calling 
> ‘gtk_style_context_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 values from gtk css file?
>
> Thanks
>
> Abhishek
>
>
> _______________________________________________
> desktop-devel-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/desktop-devel-list
--------------9sfbBOFOTVJ00cw3oG4FrmM6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Not all insensitive widgets change their color. They can also,
      for example, change their opacity, or maybe one of their children
      changes color but not the widget itself. In general, trying to
      guess stuff like that from the theme is a fool's errand, just
      hardcode something or really use css yourself.<br>
    </p>
    <div class="moz-cite-prefix">On 26/09/2022 08:32, Abhishek Kumar via
      desktop-devel-list wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:MWHPR10MB1885CC147636209A5E419957CF529@MWHPR10MB1885.namprd10.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@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;}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;}div.WordSection1
	{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hello,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I am facing an issue to read foreground
          color for insensitive widgets (e.g. menubar, spinner etc.) in
          GTK 3.<o:p></o:p></p>
        <p class="MsoNormal">I am trying to get the stylecontext for the
          widget by calling ‘gtk_widget_get_style_context’ API and
          <o:p></o:p></p>
        <p class="MsoNormal">then get the foreground color for
          insensitive state by calling ‘gtk_style_context_get_color’
          API.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">The returned color value is having 0.2396
          for red, green and blue component which is wrong.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I am using Ubuntu 22.04 and theme is
          ‘Yaru’.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Can anyone help me out what should be the
          correct approach to read color values from gtk css file?<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Thanks<o:p></o:p></p>
        <p class="MsoNormal">Abhishek<o:p></o:p></p>
        <p class="MsoNormal" style="background:white"><span
            style="font-size:11.5pt;font-family:&quot;Courier
            New&quot;;color:#080808;mso-fareast-language:EN-IN"><o:p> </o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
desktop-devel-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://mail.gnome.org/mailman/listinfo/desktop-devel-list">https://mail.gnome.org/mailman/listinfo/desktop-devel-list</a>
</pre>
    </blockquote>
  </body>
</html>

--------------9sfbBOFOTVJ00cw3oG4FrmM6--

--===============1813559391411456957==
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

--===============1813559391411456957==--