views:

895

answers:

3

Hello,

I've been making good use of the jQuery icons in my web app, but have come to a point where I would like to use a color that I'm not able to achieve by default. I'm currently using the "State Street" theme, which primarily uses green. But I have a red box with white text, and would like to use an icon that is white as well. There are white icons that are supplied with the theme, but they only get applied when the icons are inside a div (or some other container) that has a class of "ui-state-focus". This will make the icon white, but will change the background color to green, which I want to leave as red.

Is there any way (most likely via CSS) to override what background image jQuery uses for the icons, so that I can use a different color?

Thanks.

CLARIFICATION: I guess it would help for me to post the html I'm currently working with:

<!-- currently produces a default 'grey' icon color -->
<!-- this b/c no jquery ui class (like ui-state-focus) given for errorMessage div -->
<div id="errorMessage">
    <span class="ui-icon ui-icon-alert" style="float: left"></span>
    Only 1 Activity can be added at a time 
</div>

I also have CSS:

.dialog #errorMessage
{
    /*display: none;*/
    background-color: #CC3300;
    color: #FFFFFF;
    font-weight: bold;
    padding-top: 3px;
    padding-bottom: 3px;
    vertical-align: bottom;
    bottom: auto;
    font-size: .80em;
    width: 100%
}

"display: none" is currently commented out so I can see it. I do have it set up to fadeIn on error catch. Thanks again for the help.

A: 

Probably the simplest way to do that is to find out exactly what imagefile jQuery is using for the icons, and then modify that image file (or create your own) and drop it into place.

singingwolfboy
That would certainly work, but other parts of my page use classes that make use of the default grey icons, and do it appropriately. I wouldn't want to mess up those icons to achieve the white icon effect in only one place.
Mega Matt
+2  A: 

SELF-ANSWER: Specified the background-image URL myself to be the file that uses the white icons. So I added a few lines to my CSS file:

.dialog #errorMessage .ui-icon
{
    background-image: url(../../CSS/themes/custom_green/imag/ui-icons_ffffff_256x240.png);
}

This essentially overrides the background image that the default jQuery css file wants to use for the icon, and achieved the color that I wanted. Of course this only worked because a white icon .png file was included with the theme. If I wanted some crazy color, like purple, I would have needed to create my own icon(s). Note that I needed to lengthen the URL in my own CSS file versus the URL that is specified in the jQuery CSS file, because they're located in two different places in my source.

Mega Matt
i too found this. but is there a easy way to change the color of the icons?
Prasad
Thanks for this! I wanted to make my "delete" button icons red but leave the others as default. Works like a champ, but hopefully they add a better way someday.
Kevin Pauli
A: 

But is there any place where i can get icons set of ui of my choice ready made.