Add subtle text style support

This commit is contained in:
mkpaz 2022-10-06 13:00:09 +04:00
parent 92a4f885ae
commit 8af9bdfc7f
3 changed files with 19 additions and 8 deletions

@ -7,8 +7,6 @@ import javafx.scene.Node;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Styles { public final class Styles {
// @formatter:off
// Colors // Colors
public static final String ACCENT = "accent"; public static final String ACCENT = "accent";
@ -73,7 +71,9 @@ public final class Styles {
public static final String TEXT_OBLIQUE = "text-oblique"; public static final String TEXT_OBLIQUE = "text-oblique";
public static final String TEXT_STRIKETHROUGH = "text-strikethrough"; public static final String TEXT_STRIKETHROUGH = "text-strikethrough";
public static final String TEXT_UNDERLINED = "text-underlined"; public static final String TEXT_UNDERLINED = "text-underlined";
public static final String TEXT_MUTED = "text-muted"; public static final String TEXT_MUTED = "text-muted";
public static final String TEXT_SUBTLE = "text-subtle";
/** /**
* Initialize a new Styles * Initialize a new Styles
@ -82,8 +82,6 @@ public final class Styles {
// Default constructor // Default constructor
} }
// @formatter:on
public static void toggleStyleClass(Node node, String styleClass) { public static void toggleStyleClass(Node node, String styleClass) {
if (node == null) if (node == null)
throw new NullPointerException("Node cannot be null!"); throw new NullPointerException("Node cannot be null!");

@ -249,7 +249,9 @@ public class TypographyPage extends AbstractPage {
createText("Accent", TEXT, ACCENT), createText("Accent", TEXT, ACCENT),
createText("Success", TEXT, SUCCESS), createText("Success", TEXT, SUCCESS),
createText("Warning", TEXT, WARNING), createText("Warning", TEXT, WARNING),
createText("Danger", TEXT, DANGER) createText("Danger", TEXT, DANGER),
createText("Muted", TEXT, TEXT_MUTED),
createText("Subtle", TEXT, TEXT_SUBTLE)
); );
box.setAlignment(Pos.BASELINE_LEFT); box.setAlignment(Pos.BASELINE_LEFT);

@ -91,11 +91,22 @@ Text {
-fx-fill: -color-fg-muted; -fx-fill: -color-fg-muted;
} }
.label.text-muted { .label.text-muted {
-fx-text-fill: -color-accent-fg; -fx-text-fill: -color-fg-muted;
#{cfg.$font-icon-selector} { #{cfg.$font-icon-selector} {
-fx-icon-color: -color-accent-fg; -fx-icon-color: -color-fg-muted;
-fx-fill: -color-accent-fg; -fx-fill: -color-fg-muted;
}
}
.text-subtle {
-fx-fill: -color-fg-subtle;
}
.label.text-subtle {
-fx-text-fill: -color-fg-subtle;
#{cfg.$font-icon-selector} {
-fx-icon-color: -color-fg-subtle;
-fx-fill: -color-fg-subtle;
} }
} }