Skip to content

Commit 71fa44d

Browse files
committed
Icons responsive to Color Change
1 parent f714d20 commit 71fa44d

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

src/main/java/de/doubleslash/keeptime/view/ViewController.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import de.doubleslash.keeptime.model.Model;
3737
import de.doubleslash.keeptime.model.Project;
3838
import de.doubleslash.keeptime.view.time.Interval;
39+
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
3940
import javafx.application.Platform;
4041
import javafx.beans.binding.Bindings;
4142
import javafx.beans.property.BooleanProperty;
@@ -61,8 +62,6 @@
6162
import javafx.scene.control.ListView;
6263
import javafx.scene.control.TextArea;
6364
import javafx.scene.control.TextField;
64-
import javafx.scene.effect.Light;
65-
import javafx.scene.effect.Lighting;
6665
import javafx.scene.image.Image;
6766
import javafx.scene.image.ImageView;
6867
import javafx.scene.image.WritableImage;
@@ -126,6 +125,18 @@ public class ViewController {
126125
@FXML
127126
private Canvas canvas;
128127

128+
@FXML
129+
private FontAwesomeIconView calendarIcon;
130+
131+
@FXML
132+
private FontAwesomeIconView settingsIcon;
133+
134+
@FXML
135+
private FontAwesomeIconView minimizeIcon;
136+
137+
@FXML
138+
private FontAwesomeIconView closeIcon;
139+
129140
private ColorTimeLine mainColorTimeLine;
130141

131142
private class Delta {
@@ -188,19 +199,14 @@ private void initialize() {
188199

189200
addNewProjectButton.textFillProperty().bind(fontColorProperty);
190201

191-
// Add a light to colorize buttons
192-
// TODO is there a nicer way for this? (see #12)
193-
final Lighting lighting = new Lighting();
194-
lighting.lightProperty().bind(Bindings.createObjectBinding(() -> {
195-
final Color color = fontColorProperty.get();
196-
return new Light.Distant(45, 45, color);
197-
}, fontColorProperty));
198-
199202
settingsButton.setOnAction(ae -> settingsClicked());
200-
settingsButton.setEffect(lighting);
201203

202204
calendarButton.setOnAction(ae -> calendarClicked());
203-
calendarButton.setEffect(lighting);
205+
206+
calendarIcon.fillProperty().bind(fontColorProperty);
207+
settingsIcon.fillProperty().bind(fontColorProperty);
208+
minimizeIcon.fillProperty().bind(fontColorProperty);
209+
closeIcon.fillProperty().bind(fontColorProperty);
204210

205211
final Runnable updateMainBackgroundColor = this::runUpdateMainBackgroundColor;
206212

src/main/resources/layouts/ViewLayout.fxml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
<center>
5252
<HBox alignment="CENTER" prefHeight="36.0">
5353
<children>
54-
<Button fx:id="calendarButton" mnemonicParsing="false" prefHeight="11.0" prefWidth="21.0" stylesheets="@../css/application.css">
54+
<Button fx:id="calendarButton" mnemonicParsing="false" prefHeight="25.0" prefWidth="22.0" stylesheets="@../css/application.css">
5555
<graphic>
56-
<FontAwesomeIconView glyphName="CALENDAR" glyphStyle="fas" size="20" />
56+
<FontAwesomeIconView fx:id="calendarIcon" glyphName="CALENDAR" glyphStyle="fas" size="20" text="" />
5757
</graphic>
5858
</Button>
5959
<Button fx:id="settingsButton" mnemonicParsing="false" prefHeight="25.0" prefWidth="22.0" stylesheets="@../css/application.css">
6060
<graphic>
61-
<FontAwesomeIconView glyphName="COG" glyphStyle="fas" size="20" />
61+
<FontAwesomeIconView fx:id="settingsIcon" glyphName="COG" glyphStyle="fas" size="20" />
6262
</graphic>
6363
</Button>
6464
</children>
@@ -90,14 +90,14 @@
9090
<Font name="Open Sans Regular" size="12.0" />
9191
</font>
9292
<graphic>
93-
<FontAwesomeIconView glyphName="WINDOW_MINIMIZE" glyphStyle="fas" size="10" text="" />
93+
<FontAwesomeIconView fx:id="minimizeIcon" glyphName="WINDOW_MINIMIZE" glyphStyle="fas" size="10" text="" />
9494
</graphic></Button>
9595
<Button fx:id="closeButton" layoutX="287.0" layoutY="7.0" mnemonicParsing="false" stylesheets="@../css/application.css">
9696
<font>
9797
<Font name="Open Sans Regular" size="12.0" />
9898
</font>
9999
<graphic>
100-
<FontAwesomeIconView glyphName="TIMES" glyphStyle="fas" size="10" />
100+
<FontAwesomeIconView fx:id="closeIcon" glyphName="TIMES" glyphStyle="fas" size="10" />
101101
</graphic>
102102
</Button>
103103
</children>

0 commit comments

Comments
 (0)