Skip to content

Commit

Permalink
HouariZegai#32 issue: Update Dark Theme
Browse files Browse the repository at this point in the history
  • Loading branch information
adi-075 committed Jan 21, 2023
1 parent 7906835 commit 0c7e17f
Showing 1 changed file with 74 additions and 39 deletions.
113 changes: 74 additions & 39 deletions src/main/java/com/houarizegai/calculator/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public Calculator() {
window = new JFrame("Calculator");
window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
window.setLocationRelativeTo(null); // Move window to center


comboTheme = initCombo(new String[]{"Simple", "Colored", "DarkTheme"}, 230, 30, "Theme", themeSwitchEventConsumer);

comboCalcType = initCombo(new String[]{"Standard", "Scientific"}, 20, 30, "Calculator type", calcTypeSwitchEventConsumer);

int[] x = {MARGIN_X, MARGIN_X + 90, 200, 290, 380};
Expand Down Expand Up @@ -579,44 +579,79 @@ private void repaintFont() {
btnRoot.setForeground(Color.WHITE);
break;
case "DarkTheme":
final Color primaryDarkColor = new Color(141, 38, 99);
final Color secondaryDarkColor = new Color(171, 171, 171);

window.getContentPane().setBackground(new Color(68, 68, 68));
btn0.setBackground(secondaryDarkColor);
btn1.setBackground(secondaryDarkColor);
btn2.setBackground(secondaryDarkColor);
btn3.setBackground(secondaryDarkColor);
btn4.setBackground(secondaryDarkColor);
btn5.setBackground(secondaryDarkColor);
btn6.setBackground(secondaryDarkColor);
btn7.setBackground(secondaryDarkColor);
btn8.setBackground(secondaryDarkColor);
btn9.setBackground(secondaryDarkColor);
btnPoint.setBackground(secondaryDarkColor);

btnC.setForeground(secondaryDarkColor);
btnBack.setForeground(secondaryDarkColor);
btnMod.setForeground(secondaryDarkColor);
btnDiv.setForeground(secondaryDarkColor);
btnMul.setForeground(secondaryDarkColor);
btnSub.setForeground(secondaryDarkColor);
btnAdd.setForeground(secondaryDarkColor);
btnEqual.setForeground(secondaryDarkColor);
btnLog.setForeground(secondaryDarkColor);
btnPower.setForeground(secondaryDarkColor);
btnRoot.setForeground(secondaryDarkColor);
btnC.setBackground(primaryDarkColor);
btnBack.setBackground(primaryDarkColor);
btnMod.setBackground(primaryDarkColor);
btnDiv.setBackground(primaryDarkColor);
btnMul.setBackground(primaryDarkColor);
btnSub.setBackground(primaryDarkColor);
btnAdd.setBackground(primaryDarkColor);
btnRoot.setBackground(primaryDarkColor);
btnLog.setBackground(primaryDarkColor);
btnPower.setBackground(primaryDarkColor);
btnEqual.setBackground(primaryDarkColor);
// final Color primaryDarkColor = new Color(141, 38, 99);
// final Color secondaryDarkColor = new Color(171, 171, 171);

window.getContentPane().setBackground(new Color(25, 20, 20));
inText.setBackground(new Color(106,151,76));
// btn0.setBackground(secondaryDarkColor);
// btn1.setBackground(secondaryDarkColor);
// btn2.setBackground(secondaryDarkColor);
// btn3.setBackground(secondaryDarkColor);
// btn4.setBackground(secondaryDarkColor);
// btn5.setBackground(secondaryDarkColor);
// btn6.setBackground(secondaryDarkColor);
// btn7.setBackground(secondaryDarkColor);
// btn8.setBackground(secondaryDarkColor);
// btn9.setBackground(secondaryDarkColor);
// btnPoint.setBackground(secondaryDarkColor);
//
// btnC.setForeground(secondaryDarkColor);
// btnBack.setForeground(secondaryDarkColor);
// btnMod.setForeground(secondaryDarkColor);
// btnDiv.setForeground(secondaryDarkColor);
// btnMul.setForeground(secondaryDarkColor);
// btnSub.setForeground(secondaryDarkColor);
// btnAdd.setForeground(secondaryDarkColor);
// btnEqual.setForeground(secondaryDarkColor);
// btnLog.setForeground(secondaryDarkColor);
// btnPower.setForeground(secondaryDarkColor);
// btnRoot.setForeground(secondaryDarkColor);
// btnC.setBackground(primaryDarkColor);
// btnBack.setBackground(primaryDarkColor);
// btnMod.setBackground(primaryDarkColor);
// btnDiv.setBackground(primaryDarkColor);
// btnMul.setBackground(primaryDarkColor);
// btnSub.setBackground(primaryDarkColor);
// btnAdd.setBackground(primaryDarkColor);
// btnRoot.setBackground(primaryDarkColor);
// btnLog.setBackground(primaryDarkColor);
// btnPower.setBackground(primaryDarkColor);
// btnEqual.setBackground(primaryDarkColor);
btnC.setBackground(Color.RED);
btnBack.setBackground(new Color(186,85,211));
btnMod.setBackground(new Color(186,85,211));
btnDiv.setBackground(new Color(186,85,211));
btnMul.setBackground(new Color(186,85,211));
btnSub.setBackground(new Color(186,85,211));
btnAdd.setBackground(new Color(186,85,211));
btnRoot.setBackground(new Color(186,85,211));
btnLog.setBackground(new Color(186,85,211));
btnPower.setBackground(new Color(186,85,211));
btnEqual.setBackground(new Color(30, 215, 96));
btn0.setBackground(new Color(83,104,114));
btn1.setBackground(new Color(83,104,114));
btn2.setBackground(new Color(83,104,114));
btn3.setBackground(new Color(83,104,114));
btn4.setBackground(new Color(83,104,114));
btn5.setBackground(new Color(83,104,114));
btn6.setBackground(new Color(83,104,114));
btn7.setBackground(new Color(83,104,114));
btn8.setBackground(new Color(83,104,114));
btn9.setBackground(new Color(83,104,114));
btnPoint.setBackground(new Color(186,85,211));

btnC.setForeground(Color.WHITE);
btnBack.setForeground(Color.WHITE);
btnMod.setForeground(Color.WHITE);
btnDiv.setForeground(Color.WHITE);
btnMul.setForeground(Color.WHITE);
btnSub.setForeground(Color.WHITE);
btnAdd.setForeground(Color.WHITE);
btnEqual.setForeground(Color.WHITE);
btnLog.setForeground(Color.WHITE);
btnPower.setForeground(Color.WHITE);
btnRoot.setForeground(Color.WHITE);
}
};

Expand Down

0 comments on commit 0c7e17f

Please sign in to comment.