Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
macOS light and dark themes (issue #497)
- Loading branch information
Showing
20 changed files
with
4,041 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,7 @@ out/ | |
*.iml | ||
*.ipr | ||
*.iws | ||
*.xcuserstate | ||
*.xcworkspacedata | ||
.vs/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
flatlaf-core/src/main/java/com/formdev/flatlaf/themes/FlatMacDarkLaf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2022 FormDev Software GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.formdev.flatlaf.themes; | ||
|
||
import javax.swing.UIManager; | ||
import com.formdev.flatlaf.FlatDarkLaf; | ||
|
||
/** | ||
* A Flat LaF that imitates macOS dark look. | ||
* <p> | ||
* The UI defaults are loaded from {@code FlatMacDarkLaf.properties}, | ||
* {@code FlatDarkLaf.properties} and {@code FlatLaf.properties}. | ||
* | ||
* @author Karl Tauber | ||
* @since 3 | ||
*/ | ||
public class FlatMacDarkLaf | ||
extends FlatDarkLaf | ||
{ | ||
public static final String NAME = "FlatLaf macOS Dark"; | ||
|
||
/** | ||
* Sets the application look and feel to this LaF | ||
* using {@link UIManager#setLookAndFeel(javax.swing.LookAndFeel)}. | ||
*/ | ||
public static boolean setup() { | ||
return setup( new FlatMacDarkLaf() ); | ||
} | ||
|
||
/** | ||
* Adds this look and feel to the set of available look and feels. | ||
* <p> | ||
* Useful if your application uses {@link UIManager#getInstalledLookAndFeels()} | ||
* to query available LaFs and display them to the user in a combobox. | ||
*/ | ||
public static void installLafInfo() { | ||
installLafInfo( NAME, FlatMacDarkLaf.class ); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "FlatLaf macOS Dark Look and Feel"; | ||
} | ||
|
||
@Override | ||
public boolean isDark() { | ||
return true; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
flatlaf-core/src/main/java/com/formdev/flatlaf/themes/FlatMacLightLaf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2022 FormDev Software GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.formdev.flatlaf.themes; | ||
|
||
import javax.swing.UIManager; | ||
import com.formdev.flatlaf.FlatLightLaf; | ||
|
||
/** | ||
* A Flat LaF that imitates macOS light look. | ||
* <p> | ||
* The UI defaults are loaded from {@code FlatMacLightLaf.properties}, | ||
* {@code FlatLightLaf.properties} and {@code FlatLaf.properties}. | ||
* | ||
* @author Karl Tauber | ||
* @since 3 | ||
*/ | ||
public class FlatMacLightLaf | ||
extends FlatLightLaf | ||
{ | ||
public static final String NAME = "FlatLaf macOS Light"; | ||
|
||
/** | ||
* Sets the application look and feel to this LaF | ||
* using {@link UIManager#setLookAndFeel(javax.swing.LookAndFeel)}. | ||
*/ | ||
public static boolean setup() { | ||
return setup( new FlatMacLightLaf() ); | ||
} | ||
|
||
/** | ||
* Adds this look and feel to the set of available look and feels. | ||
* <p> | ||
* Useful if your application uses {@link UIManager#getInstalledLookAndFeels()} | ||
* to query available LaFs and display them to the user in a combobox. | ||
*/ | ||
public static void installLafInfo() { | ||
installLafInfo( NAME, FlatMacLightLaf.class ); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "FlatLaf macOS Light Look and Feel"; | ||
} | ||
|
||
@Override | ||
public boolean isDark() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.