agonist_
agonist_

Reputation: 5032

Change button graphic color with css

Hi want to do a menubar like Twitter where the icon on the menu button, have there color changed on hover.

There is a way to do that in JavaFX + CSS ? (An other way than just change the png file)

that will look like that

.button:hover {
-fx-text-fill: red;
-fx-border-width: 0 0 5 0 ;
-fx-border-color:red ;
-fx-png-on-the-button-color: red;      //Need the way to do something like that

}

Upvotes: 1

Views: 2597

Answers (2)

agonist_
agonist_

Reputation: 5032

Ugly solution of myself

.button:hover ImageView {
-fx-effect: innershadow( gaussian , red , 7 , 1 , 1 , 1 );

}

with this innershadow of the color you want, the result is pretty cool. that work fine !

Upvotes: 2

Oliver Jan Krylow
Oliver Jan Krylow

Reputation: 1725

You cannot change the color of the loaded image. But instead you can just change the image, which has the color prerendered that you want.

-fx-graphic: url(http://example.com)

See http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#labeled.

Upvotes: 0

Related Questions