Skip to content

Commit

Permalink
fixed css hex color prefix (see #527)
Browse files Browse the repository at this point in the history
  • Loading branch information
ennerf committed Sep 28, 2023
1 parent 9508d3c commit 15f88c3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ private DataSet getTestDataSet() {

if (n == 6) {
dataSet.addDataStyle(n, style.reset()
.setLineColor("0xEE00EE")
.setMarkerColor("0xEE00EE")
.setLineColor("#EE00EE")
.setMarkerColor("#EE00EE")
.setStrokeDashPattern(5, 8, 5, 16)
.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void testStyleParserAuto() {
assertEquals(Color.BLUE, parser.getFillColor().orElseThrow());

style = builder.reset().setFill(255, 255, 0, 1).build();
assertEquals("-fx-fill: 0xffff00ff;", style);
assertEquals("-fx-fill: #ffff00ff;", style);
assertTrue(parser.tryParse(style));
assertEquals(Color.YELLOW, parser.getFillColor().orElseThrow());

Expand Down Expand Up @@ -69,8 +69,8 @@ void testStyleParserAuto() {
.setLineWidth(3)
.setFont("monospace")
.setFontItalic(true)
.setStroke("0xEE00EE")
.setFill("0xEE00EE")
.setStroke("#EE00EE")
.setFill("#EE00EE")
.setLineDashes(5, 8, 5, 16)
.setFill("blue")
.setLineDashes(3, 5, 8, 5)
Expand All @@ -83,7 +83,7 @@ void testStyleParserAuto() {
+ "-fx-line-width: 3.0;\n"
+ "-fx-font: monospace;\n"
+ "-fx-font-weight: bold;\n"
+ "-fx-stroke: 0xEE00EE;",
+ "-fx-stroke: #EE00EE;",
style);
assertTrue(parser.tryParse(style));
assertArrayEquals(new double[] { 3, 5, 8, 5 }, parser.getLineDashes().orElseThrow());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected T setColorProp(String key, double r, double g, double b, double a) {

protected T setColorProp(String key, int r, int g, int b, double a) {
int o = (int) Math.round(a * 255.0);
properties.put(key, String.format("0x%02x%02x%02x%02x", r & 0xFF, g & 0xFF, b & 0xFF, o & 0xFF));
properties.put(key, String.format("#%02x%02x%02x%02x", r & 0xFF, g & 0xFF, b & 0xFF, o & 0xFF));

Check warning on line 67 in chartfx-dataset/src/main/java/io/fair_acc/dataset/utils/StyleBuilder.java

View check run for this annotation

Codecov / codecov/patch

chartfx-dataset/src/main/java/io/fair_acc/dataset/utils/StyleBuilder.java#L67

Added line #L67 was not covered by tests
return getThis();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public Node getChartPanel(final Stage primaryStage) {

if (n == 6) {
dataSet.addDataStyle(n, style.reset()
.setStroke("0xEE00EE")
.setFill("0xEE00EE")
.setStroke("#EE00EE")
.setFill("#EE00EE")
.setStrokeDashPattern(5, 8, 5, 16)
.build());
}
Expand Down

0 comments on commit 15f88c3

Please sign in to comment.