0

I want to modify this code and make the progress bar green:

.progress-bar > .bar {
    -fx-background-color: linear-gradient(
        from 0px .75em to .75em 0px,
        repeat,
        -fx-accent 0%,
        -fx-accent 49%,
        derive(-fx-accent, 30%) 50%,
        derive(-fx-accent, 30%) 99%
        );
}

How I can modify the code to change the visual layout?

Peter Penzov
  • 1,126
  • 134
  • 430
  • 808
  • See the StackOverflow community wiki: [How can I style the ProgressBar component in JavaFX?](http://stackoverflow.com/questions/19417246/how-can-i-style-the-progressbar-component-in-javafx) – jewelsea Nov 10 '13 at 17:29

1 Answers1

2

Simply overwrite the color constant -fx-accent the gradient colors are derived from:

.progress-bar > .bar {
    -fx-accent: green;
    -fx-background-color: linear-gradient(
        from 0px .75em to .75em 0px,
        repeat,
        -fx-accent 0%,
        -fx-accent 49%,
        derive(-fx-accent, 30%) 50%,
        derive(-fx-accent, 30%) 99%
        );
}
Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106