Re: Modifying a css property from js
- From: "Jasper St. Pierre" <jstpierre mecheye net>
- To: Thiago Bellini Ribeiro <hackedbellini gmail com>
- Cc: Gnome shell list <gnome-shell-list gnome org>
- Subject: Re: Modifying a css property from js
- Date: Wed, 2 May 2012 10:54:19 -0400
On Wed, May 2, 2012 at 10:40 AM, Thiago Bellini Ribeiro
<hackedbellini gmail com> wrote:
> Hi all,
>
> I'm trying to add a color setting for my extension:
> https://extensions.gnome.org/extension/258
>
> The actual approach I'm using is: I define a css with a
> '.has-notification { color: red; }' and I call
> 'add_style_class_name('has-notification')' on
> Main.panel._statusArea.userMenu._iconBox.
> Using this approach, the only way I think I can implement the settings
> is by creating some styles (red, green, yellow, blue, etc) and add the
> one the user specified.
>
> I wanted to used a ColorButton to let the user choose the color and
> them add the style based on the color hex code, so the choice wouldn't
> be limited by the range I choose above.
> So, my question is: Is there a way for me to modify that
> 'has-notification' style and change it's color on my js code. Or even,
> is there any way for specifying the color hex code directly without
> having to create a css for that?
You can use set_style to set the style of an St actor directly, like
foo.set_style('background-color: #ff0000');
> Sorry if this wasn't the place to send this question.
>
> --
> Thiago Bellini | http://hackedbellini.org
>
> “Real knowledge is to know the extent of one's ignorance.” - Confucius
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-shell-list
--
Jasper
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]