Skip to content

Commit

Permalink
First pass for the tonal Dust skin family
Browse files Browse the repository at this point in the history
Adding Dust. For #400
  • Loading branch information
kirill-grouchnikov committed Feb 6, 2025
1 parent 79d762e commit c4d448a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.pushingpixels.radiance.demo.theming.main.Check;
import org.pushingpixels.radiance.theming.api.RadianceSkin;
import org.pushingpixels.radiance.theming.api.RadianceThemingCortex;
import org.pushingpixels.radiance.theming.api.skin.NebulaAmethystSkin;
import org.pushingpixels.radiance.theming.api.skin.DustSkin;

import javax.swing.*;
import java.awt.*;
Expand All @@ -41,7 +41,7 @@

public class TonalCheck {
public static void main(String[] args) {
RadianceSkin tonalSkin = new NebulaAmethystSkin.NebulaAmethystTonalSkin();
RadianceSkin tonalSkin = new DustSkin.DustTonalSkin();

RadianceThemingCortex.GlobalScope.registerWidget("org.pushingpixels.radiance.theming" +
".extras.api.tabbed.TabHoverPreviewWidget", JTabbedPane.class, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public static abstract class TonalAccented extends RadianceSkin implements Tonal
public final static class AccentBuilder {
private RadianceColorScheme2 defaultAreaColorScheme;
private ContainerColorTokens defaultAreaHighlightTokens;
private ContainerColorTokens defaultAreaSelectedTokens;
private RadianceColorScheme2 headerAreaColorScheme;
private ContainerColorTokens headerAreaHighlightTokens;

Expand All @@ -210,6 +211,11 @@ public AccentBuilder withDefaultAreaHighlightTokens(ContainerColorTokens default
return this;
}

public AccentBuilder withDefaultAreaSelectedTokens(ContainerColorTokens defaultAreaSelectedTokens) {
this.defaultAreaSelectedTokens = defaultAreaSelectedTokens;
return this;
}

public AccentBuilder withHeaderAreaColorScheme(RadianceColorScheme2 headerAreaColorScheme) {
this.headerAreaColorScheme = headerAreaColorScheme;
return this;
Expand All @@ -223,12 +229,14 @@ public AccentBuilder withHeaderAreaHighlightTokens(ContainerColorTokens headerAr

private final RadianceColorScheme2 defaultAreaColorScheme;
private final ContainerColorTokens defaultAreaHighlightTokens;
private final ContainerColorTokens defaultAreaSelectedTokens;
private final RadianceColorScheme2 headerAreaColorScheme;
private final ContainerColorTokens headerAreaHighlightTokens;

protected TonalAccented(AccentBuilder accentBuilder) {
this.defaultAreaColorScheme = accentBuilder.defaultAreaColorScheme;
this.defaultAreaHighlightTokens = accentBuilder.defaultAreaHighlightTokens;
this.defaultAreaSelectedTokens = accentBuilder.defaultAreaSelectedTokens;
this.headerAreaColorScheme = accentBuilder.headerAreaColorScheme;
this.headerAreaHighlightTokens = accentBuilder.headerAreaHighlightTokens;
}
Expand All @@ -241,6 +249,10 @@ public ContainerColorTokens getDefaultAreaHighlightTokens() {
return this.defaultAreaHighlightTokens;
}

public ContainerColorTokens getDefaultAreaSelectedTokens() {
return this.defaultAreaSelectedTokens;
}

public RadianceColorScheme2 getHeaderAreaColorScheme() {
return this.headerAreaColorScheme;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
*/
package org.pushingpixels.radiance.theming.api.skin;

import org.pushingpixels.ephemeral.chroma.hct.Hct;
import org.pushingpixels.radiance.theming.api.RadianceSkin;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices;
import org.pushingpixels.radiance.theming.api.palette.ColorSchemeUtils;
import org.pushingpixels.radiance.theming.api.palette.PaletteResolverUtils;

/**
* <code>Dust</code> skin. This class is part of officially supported API.
Expand Down Expand Up @@ -58,4 +62,33 @@ public DustSkin() {
public String getDisplayName() {
return NAME;
}

public static class DustTonalSkin extends DustAccentedTonalSkin {
public static final String NAME = "Dust Tonal";

public DustTonalSkin() {
super(new AccentBuilder()
.withDefaultAreaColorScheme(ColorSchemeUtils.getColorScheme(
/* palettesSource */ new ColorSchemeUtils.FidelityPaletteSource(
Hct.fromInt(0xFFADA59A), Hct.fromInt(0xFFE5E2DB), Hct.fromInt(0xFFEAE7E2)),
/* activeStatesContainerType */ RadianceThemingSlices.ActiveContainerType.TONAL,
/* isDark */ false))
.withDefaultAreaSelectedTokens(ColorSchemeUtils.getContainerTokens(
/* seed */ Hct.fromInt(0xFFAE9B7A),
/* activeStatesContainerType */ RadianceThemingSlices.ActiveContainerType.TONAL,
/* isFidelity */ true,
/* isDark */ false))
.withDefaultAreaHighlightTokens(ColorSchemeUtils.getContainerTokens(
/* seed */ Hct.fromInt(0xFF5E4436),
/* isFidelity */ true,
/* isDark */ true,
/* contrast */ 0.3f,
/* colorResolver */ PaletteResolverUtils.getPaletteTonalColorResolver())));
}

@Override
public String getDisplayName() {
return NAME;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ public class RadianceDustLookAndFeel extends RadianceLookAndFeel {
public RadianceDustLookAndFeel() {
super(new DustSkin());
}

public static class RadianceDustTonalLookAndFeel extends RadianceLookAndFeel {
public RadianceDustTonalLookAndFeel() {
super(new DustSkin.DustTonalSkin());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ public Set<SkinInfo> getSkins() {
result.add(new SkinInfo(NebulaAmethystSkin.NebulaAmethystTonalSkin.NAME,
NebulaAmethystSkin.NebulaAmethystTonalSkin.class::getName,
RadianceNebulaAmethystLookAndFeel.RadianceNebulaAmethystTonalLookAndFeel.class::getName));
result.add(new SkinInfo(DustSkin.DustTonalSkin.NAME,
DustSkin.DustTonalSkin.class::getName,
RadianceDustLookAndFeel.RadianceDustTonalLookAndFeel.class::getName));

return result;
}
Expand Down

0 comments on commit c4d448a

Please sign in to comment.