Style rework

This commit is contained in:
crschnick 2024-07-05 12:51:38 +00:00
parent d39fbb5052
commit d3f8f25a85
6 changed files with 43 additions and 18 deletions

View file

@ -177,8 +177,8 @@ public class AppTheme {
private final String name; private final String name;
public DerivedTheme(String id, String cssId, String name, atlantafx.base.theme.Theme theme, String transparentColor) { public DerivedTheme(String id, String cssId, String name, atlantafx.base.theme.Theme theme) {
super(id, cssId, theme, transparentColor); super(id, cssId, theme);
this.name = name; this.name = name;
} }
@ -213,17 +213,17 @@ public class AppTheme {
@AllArgsConstructor @AllArgsConstructor
public static class Theme implements PrefsChoiceValue { public static class Theme implements PrefsChoiceValue {
public static final Theme PRIMER_LIGHT = new Theme("light", "primer", new PrimerLight(), "#ffffff88"); public static final Theme PRIMER_LIGHT = new Theme("light", "primer", new PrimerLight());
public static final Theme PRIMER_DARK = new Theme("dark", "primer", new PrimerDark(), "#0d111788"); public static final Theme PRIMER_DARK = new Theme("dark", "primer", new PrimerDark());
public static final Theme NORD_LIGHT = new Theme("nordLight", "nord", new NordLight(), "#ffffff88"); public static final Theme NORD_LIGHT = new Theme("nordLight", "nord", new NordLight());
public static final Theme NORD_DARK = new Theme("nordDark", "nord", new NordDark(), "#0d111788"); public static final Theme NORD_DARK = new Theme("nordDark", "nord", new NordDark());
public static final Theme CUPERTINO_LIGHT = new Theme("cupertinoLight", "cupertino", new CupertinoLight(), "#ffffff88"); public static final Theme CUPERTINO_LIGHT = new Theme("cupertinoLight", "cupertino", new CupertinoLight());
public static final Theme CUPERTINO_DARK = new Theme("cupertinoDark", "cupertino", new CupertinoDark(), "#0d111788"); public static final Theme CUPERTINO_DARK = new Theme("cupertinoDark", "cupertino", new CupertinoDark());
public static final Theme DRACULA = new Theme("dracula", "dracula", new Dracula(), "#0d111788"); public static final Theme DRACULA = new Theme("dracula", "dracula", new Dracula());
public static final Theme MOCHA = new DerivedTheme("mocha", "primer", "Mocha", new PrimerDark(), "#0d111788"); public static final Theme MOCHA = new DerivedTheme("mocha", "primer", "Mocha", new PrimerDark());
// Adjust this to create your own theme // Adjust this to create your own theme
public static final Theme CUSTOM = new DerivedTheme("custom", "primer", "Custom", new PrimerDark(), "#0d111788"); public static final Theme CUSTOM = new DerivedTheme("custom", "primer", "Custom", new PrimerDark());
// Also include your custom theme here // Also include your custom theme here
public static final List<Theme> ALL = List.of( public static final List<Theme> ALL = List.of(
@ -235,8 +235,6 @@ public class AppTheme {
protected final atlantafx.base.theme.Theme theme; protected final atlantafx.base.theme.Theme theme;
protected final String transparentBackground;
static Theme getDefaultLightTheme() { static Theme getDefaultLightTheme() {
return switch (OsType.getLocal()) { return switch (OsType.getLocal()) {
case OsType.Windows windows -> PRIMER_LIGHT; case OsType.Windows windows -> PRIMER_LIGHT;
@ -262,7 +260,12 @@ public class AppTheme {
} }
public List<String> getAdditionalStylesheets() { public List<String> getAdditionalStylesheets() {
return List.of(Styles.toDataURI(".root { -color-bg-default-transparent: " + transparentBackground + "; }")); var r = AppResources.getResourceURL(AppResources.XPIPE_MODULE, "theme/" + getId() + ".css");
if (r.isEmpty()) {
return List.of();
} else {
return List.of(r.get().toString());
}
} }
@Override @Override

View file

@ -9,19 +9,37 @@
-fx-background-color: transparent; -fx-background-color: transparent;
} }
.root:dark .background { .root:dark:separate-frame .background {
-fx-background-color: derive(-color-bg-default, 1%);
}
.root:light:separate-frame .background {
-fx-background-color: derive(-color-bg-default, -9%);
}
.root:dark:separate-frame.background {
-fx-background-color: derive(-color-bg-default, 1%);
}
.root:light:separate-frame.background {
-fx-background-color: derive(-color-bg-default, -9%);
}
.root:dark:seamless-frame .background {
-fx-background-color: derive(-color-bg-default-transparent, 1%); -fx-background-color: derive(-color-bg-default-transparent, 1%);
} }
.root:light .background { .root:light:seamless-frame .background {
-fx-background-color: derive(-color-bg-default-transparent, -9%); -fx-background-color: derive(-color-bg-default-transparent, -9%);
} }
.root:dark.background { .root:dark:seamless-frame.background {
-fx-background-color: derive(-color-bg-default-transparent, 1%); -fx-background-color: derive(-color-bg-default-transparent, 1%);
} }
.root:light.background { .root:light:seamless-frame.background {
-fx-background-color: derive(-color-bg-default-transparent, -9%); -fx-background-color: derive(-color-bg-default-transparent, -9%);
} }

View file

@ -0,0 +1 @@
.root { -color-bg-default-transparent: #0d1117d2; }

View file

@ -0,0 +1 @@
.root { -color-bg-default-transparent: #0d1117d2; }

View file

@ -0,0 +1 @@
.root { -color-bg-default-transparent: #FFFFFF99; }

View file

@ -0,0 +1 @@
.root { -color-bg-default-transparent: #0d1117d2; }