You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Ghazi Triki <gh...@gmail.com> on 2016/12/07 13:28:27 UTC

Shared CSS Color name as constant between multiple applications

Hello,

Is there any way to define a colour name as variable in CSS? I want to
avoid "PropertyReference" as the style or theme will be shared between
multiple applications.

I tried using styleManager.registerColorName at the application
preinitialize but it does not reload color definitions and matches them
to the already defined styles.


-- 
Cordialement,
Ghazi Triki


Re: Shared CSS Color name as constant between multiple applications

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Maybe something like:

Shared CSS:
.myStyle {
    colorName: 'red';
}

Application creation complete:
var c:CSSStyleDeclaration =
this.styleManager.getStyleDeclaration(".myStyle");
var myColor:String = c.getStyle("colorName");
Alert.show('MyColor: ' + myColor);

You could also set a hex value for color in the CSS and read it as an uint
number in the code.

Thanks,
Om



On Wed, Dec 7, 2016 at 5:28 AM, Ghazi Triki <gh...@gmail.com>
wrote:

> Hello,
>
> Is there any way to define a colour name as variable in CSS? I want to
> avoid "PropertyReference" as the style or theme will be shared between
> multiple applications.
>
> I tried using styleManager.registerColorName at the application
> preinitialize but it does not reload color definitions and matches them
> to the already defined styles.
>
>
> --
> Cordialement,
> Ghazi Triki
>
>

Re: Shared CSS Color name as constant between multiple applications

Posted by Alex Harui <ah...@adobe.com>.
On 12/7/16, 5:28 AM, "Ghazi Triki" <gh...@gmail.com> wrote:

>Hello,
>
>Is there any way to define a colour name as variable in CSS?

I think it depends.  How are you using it?  In MXML or AS?  The compiler
might already have a list of known color names that is less easy to extend.


-Alex