[CLOSED] Label Style / Obtain label color based on theme

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Label Style / Obtain label color based on theme

    Per the attached image,
    I have a few ButtonGroups in a toolbar.
    Some have button , which, when I changed themes to Default, look great, the labels stay dark.
    But when I switch to Slate Theme, the labels stay dark, but the buttons light up and are more visible..

    My goal is too somehow set the label StyleSpec to a style class that the buttons use, because they work.

    I've tried to FireFox and locate the style: x-btn-text...
    But when I try to apply to "Cls="x-btn-text" on the label , it doesn't work.

    Any ideas?


  2. #2

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Hi,

    But
    when I try to apply to "Cls="x-btn-text" on the label , it doesn't
    work.

    "x-btn-text"
    css rule defines padding and cursor only, it doesn't contain color rule. I am not sure what are you waiting from that rule.

    I can recommend to create own css file for Slate theme and attach it to the page when you switch to the Slate
    In that file add
    .x-label-value{color: #fff;}
  3. #3

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Ok, but this only solves the problem for the theme Slate. What about access and all the others? Making a case statement doesn't work. What if I add more themes?

    In short, it would be nice if there were a way to obtain these values from a library of sorts, then I could make this dynamic.

    Maybe a static theme helper class to pull out values like color?
  4. #4

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Hi,

    How we can divine which theme will be used (you can attach custom theme)? I don't see any other way, only create css file for each theme with your css rules. Theme is css file also. Therefore I don't see a problem attach required css file for each theme


    Maybe a static theme helper class to pull out values like color?
    What advantages has that helper class compare with css files? Can you provide code mockup how to work with such helper?
  5. #5

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Sure.

    
    protected void On_Load()
    {
    
    this.page.registerclientscriptblock(typeof(string),string.format("<style>.labelcolor{color:{{0}}}</style>",Ext.net.Theme.CurrentLabelColor)); 
    
    }
  6. #6

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Hi,

    Hmm, I am not sure how that helper can help you.

    You can always to register own style rule using RegisterClientStyleBlock or RegisterClientStyleInclude methods of the ResourceManager. Therefore you can always attach css files which contain required css rules for particular theme
  7. #7

    RE: [CLOSED] Label Style / Obtain label color based on theme

    It helps because:

    1. I can leverage the current themes that come with Coolite.
    2. My style can change dynamically, as does the selected style selected by the user.
    3. I don't have to keep track of different styles and their respective style sheets/location.
    4. If I wanted to create my own user controls that are coolite theme sensitive.

  8. #8

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Hi,

    I don't see how the helper class can solve all those problems. What difference between helper and RegisterClientStyleBlock?
    Just I don't understand how the suggested helper should work. May be you can provide more details about helper
  9. #9

    RE: [CLOSED] Label Style / Obtain label color based on theme

    My goes is simply to pull out values that Coolite Themes store.
    Like color for labels.

    Right now, if I try to apply "x-btn-text", but it only has css rule defines padding and cursor only..then what style should I use to obtain the text color of a button in a ButtonGroup?


  10. #10

    RE: [CLOSED] Label Style / Obtain label color based on theme

    Hi,

    Button use the following css rule to set text color
    .x-btn BUTTON{...}

    As you can see that rule is applied on BUTTON tags only


    You have to create separate css rule and apply it when Slate theme is selected. I don't see another way to accomplish your goal. It is standard way
    . x-btn-group .x-label-value{color: #fff;}
Page 1 of 2 12 LastLast

Similar Threads

  1. How to apply a theme to <ext:Label /> control?
    By vadym.f in forum 1.x Help
    Replies: 2
    Last Post: Jan 17, 2012, 12:03 PM
  2. Replies: 3
    Last Post: Aug 04, 2010, 9:00 PM
  3. How to change the font color for Ext Label
    By rasu_13 in forum 1.x Help
    Replies: 0
    Last Post: Apr 03, 2010, 3:12 AM
  4. Label style
    By javito in forum 1.x Help
    Replies: 2
    Last Post: Oct 08, 2009, 9:46 AM
  5. How to set style of label?
    By dbassett74 in forum 1.x Help
    Replies: 2
    Last Post: May 07, 2009, 6:36 PM

Posting Permissions