Skip to content

Commit

Permalink
First pass for tonal Office Silver 2007
Browse files Browse the repository at this point in the history
* Move `ContainerColorTokensSingleColorQuery` to `colorscheme` package
* Add `DelegateFractionBasedTonalBorderPainter`
* Remove highlight APIs from `RadianceColorSchemeBundle2`
* Add `ContainerColorTokensSingleColorQuery.composite`
* Add `ContainerColorTokensTransform`
* Add `RadianceColorScheme2.getActiveContainerTokens`

For #400
  • Loading branch information
kirill-grouchnikov committed Jan 5, 2025
1 parent bf76167 commit 4be2e72
Show file tree
Hide file tree
Showing 23 changed files with 759 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@

import com.jgoodies.forms.builder.FormBuilder;
import com.jgoodies.forms.factories.Paddings;
import org.pushingpixels.radiance.theming.api.ComponentState;
import org.pushingpixels.radiance.theming.api.RadianceThemingCortex;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices.ColorSchemeAssociationKind;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices.DecorationAreaType;
import org.pushingpixels.radiance.theming.extras.api.skinpack.OfficeSilver2007Skin;

import javax.swing.*;
Expand All @@ -44,10 +41,7 @@ public class ControlStatesExtended extends JFrame {
public ControlStatesExtended() {
super("States");

setIconImage(RadianceLogo.getLogoImage(this,
RadianceThemingCortex.ComponentScope.getCurrentSkin(this.getRootPane())
.getColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE,
ColorSchemeAssociationKind.FILL, ComponentState.ENABLED)));
RadianceLogo.tonalConfigureOn(this);

FormBuilder builder = FormBuilder.create().
columns("right:pref, 4dlu, fill:pref:grow").
Expand Down
1 change: 1 addition & 0 deletions theming-extras/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
implementation project(':common')
implementation project(':animation')
implementation project(':theming')
implementation libs.ephemeral.chroma
}

ext.designation = "core"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,24 @@
*/
package org.pushingpixels.radiance.theming.extras.api.skinpack;

import org.pushingpixels.radiance.theming.api.ComponentState;
import org.pushingpixels.radiance.theming.api.RadianceColorSchemeBundle;
import org.pushingpixels.radiance.theming.api.RadianceSkin;
import org.pushingpixels.ephemeral.chroma.hct.Hct;
import org.pushingpixels.radiance.theming.api.*;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices.ColorSchemeAssociationKind;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices.DecorationAreaType;
import org.pushingpixels.radiance.theming.api.colorscheme.ColorSchemeSingleColorQuery;
import org.pushingpixels.radiance.theming.api.colorscheme.ColorTransform;
import org.pushingpixels.radiance.theming.api.colorscheme.ContainerColorTokensSingleColorQuery;
import org.pushingpixels.radiance.theming.api.colorscheme.RadianceColorScheme;
import org.pushingpixels.radiance.theming.api.painter.border.CompositeBorderPainter;
import org.pushingpixels.radiance.theming.api.painter.border.DelegateFractionBasedBorderPainter;
import org.pushingpixels.radiance.theming.api.painter.border.FractionBasedBorderPainter;
import org.pushingpixels.radiance.theming.api.painter.border.DelegateFractionBasedTonalBorderPainter;
import org.pushingpixels.radiance.theming.api.painter.border.FractionBasedTonalBorderPainter;
import org.pushingpixels.radiance.theming.api.painter.border.RadianceBorderPainter;
import org.pushingpixels.radiance.theming.api.painter.decoration.FractionBasedDecorationPainter;
import org.pushingpixels.radiance.theming.api.painter.fill.ClassicFillPainter;
import org.pushingpixels.radiance.theming.api.painter.fill.FractionBasedFillPainter;
import org.pushingpixels.radiance.theming.api.painter.overlay.BottomLineOverlayPainter;
import org.pushingpixels.radiance.theming.api.painter.decoration.FractionBasedTonalDecorationPainter;
import org.pushingpixels.radiance.theming.api.painter.fill.ClassicTonalFillPainter;
import org.pushingpixels.radiance.theming.api.painter.fill.FractionBasedTonalFillPainter;
import org.pushingpixels.radiance.theming.api.painter.overlay.BottomLineTonalOverlayPainter;
import org.pushingpixels.radiance.theming.api.palette.ColorSchemeUtils;
import org.pushingpixels.radiance.theming.api.palette.RadianceColorScheme2;
import org.pushingpixels.radiance.theming.api.palette.TonalSkin;
import org.pushingpixels.radiance.theming.api.shaper.ClassicButtonShaper;

/**
Expand All @@ -53,7 +55,7 @@
*
* @author Kirill Grouchnikov
*/
public class OfficeSilver2007Skin extends RadianceSkin {
public class OfficeSilver2007Skin extends RadianceSkin implements TonalSkin {
/**
* Display name for <code>this</code> skin.
*/
Expand Down Expand Up @@ -216,47 +218,97 @@ public OfficeSilver2007Skin() {
DecorationAreaType.PRIMARY_TITLE_PANE,
DecorationAreaType.SECONDARY_TITLE_PANE);

this.addOverlayPainter(new BottomLineOverlayPainter(
ColorSchemeSingleColorQuery.composite(ColorSchemeSingleColorQuery.FOREGROUND,
ColorTransform.alpha(72))),
DecorationAreaType.PRIMARY_TITLE_PANE,
DecorationAreaType.SECONDARY_TITLE_PANE);
RadianceColorScheme2 officeSilverColorScheme =
ColorSchemeUtils.getLightTonalFidelityColorScheme(Hct.fromInt(0xFFC6CACF),
Hct.fromInt(0xFFE6EAEE), Hct.fromInt(0xFFF2F5F5));
RadianceColorSchemeBundle2 officeSilverDefaultBundle =
new RadianceColorSchemeBundle2(officeSilverColorScheme);

RadianceColorScheme2 rolloverScheme2 = ColorSchemeUtils.getLightTonalFidelityColorScheme(
Hct.fromInt(0xFFFFD111), Hct.fromInt(0xFFE6EAEE), Hct.fromInt(0xFFF2F5F5));
RadianceColorScheme2 selectedScheme2 = ColorSchemeUtils.getLightTonalFidelityColorScheme(
Hct.fromInt(0xFFFFB340), Hct.fromInt(0xFFE6EAEE), Hct.fromInt(0xFFF2F5F5));
RadianceColorScheme2 rolloverSelectedScheme2 = ColorSchemeUtils.getLightTonalFidelityColorScheme(
Hct.fromInt(0xFFFFA400), Hct.fromInt(0xFFE6EAEE), Hct.fromInt(0xFFF2F5F5));
RadianceColorScheme2 pressedScheme2 = ColorSchemeUtils.getLightTonalFidelityColorScheme(
Hct.fromInt(0xFFFF8C18), Hct.fromInt(0xFFE6EAEE), Hct.fromInt(0xFFF2F5F5));
RadianceColorScheme2 pressedSelectedScheme2 = ColorSchemeUtils.getLightTonalFidelityColorScheme(
Hct.fromInt(0xFFFF991C), Hct.fromInt(0xFFE6EAEE), Hct.fromInt(0xFFF2F5F5));;

// register state-specific color schemes on rollovers, presses and selections
officeSilverDefaultBundle.registerColorScheme(rolloverScheme2,
ComponentState.ROLLOVER_UNSELECTED);
officeSilverDefaultBundle.registerColorScheme(rolloverSelectedScheme2,
ComponentState.ROLLOVER_SELECTED);
officeSilverDefaultBundle.registerColorScheme(selectedScheme2,
ComponentState.SELECTED);
officeSilverDefaultBundle.registerColorScheme(pressedScheme2,
ComponentState.PRESSED_UNSELECTED);
officeSilverDefaultBundle.registerColorScheme(pressedSelectedScheme2,
ComponentState.PRESSED_SELECTED);

// register state-specific highlight color schemes on rollover and selections
officeSilverDefaultBundle.registerColorScheme(rolloverScheme2,
RadianceThemingSlices.ContainerColorTokensAssociationKind.HIGHLIGHT,
ComponentState.ROLLOVER_UNSELECTED);
officeSilverDefaultBundle.registerColorScheme(selectedScheme2,
RadianceThemingSlices.ContainerColorTokensAssociationKind.HIGHLIGHT,
ComponentState.SELECTED, ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);
officeSilverDefaultBundle.registerColorScheme(rolloverSelectedScheme2,
RadianceThemingSlices.ContainerColorTokensAssociationKind.HIGHLIGHT,
ComponentState.ROLLOVER_SELECTED);

// marks
RadianceColorScheme2 markEnabledScheme2 = ColorSchemeUtils.getLightTonalFidelityColorScheme(
Hct.fromInt(0xFFFDD07C), Hct.fromInt(0xFFF1F3F3), Hct.fromInt(0xFFF2F5F5));
officeSilverDefaultBundle.registerColorScheme(markEnabledScheme2,
RadianceThemingSlices.ContainerColorTokensAssociationKind.MARK, ComponentState.ENABLED);

this.registerDecorationAreaSchemeBundle(officeSilverDefaultBundle,
RadianceThemingSlices.DecorationAreaType.NONE);

this.addOverlayPainter(new BottomLineTonalOverlayPainter(
ContainerColorTokensSingleColorQuery.composite(
ContainerColorTokensSingleColorQuery.CONTAINER_OUTLINE, ColorTransform.alpha(72))),
DecorationAreaType.PRIMARY_TITLE_PANE,
DecorationAreaType.SECONDARY_TITLE_PANE);

this.buttonShaper = new ClassicButtonShaper();

this.fillPainter = new FractionBasedFillPainter("Office Silver 2007",
this.fillPainter = new FractionBasedTonalFillPainter("Office Silver 2007",
new float[] {0.0f, 0.49999f, 0.5f, 1.0f},
new ColorSchemeSingleColorQuery[] {
ColorSchemeSingleColorQuery.ULTRALIGHT,
ColorSchemeSingleColorQuery.LIGHT,
ColorSchemeSingleColorQuery.ULTRADARK,
ColorSchemeSingleColorQuery.EXTRALIGHT});
new ContainerColorTokensSingleColorQuery[] {
ContainerColorTokensSingleColorQuery.CONTAINER_LOW,
ContainerColorTokensSingleColorQuery.CONTAINER_LOWEST,
ContainerColorTokensSingleColorQuery.CONTAINER,
ContainerColorTokensSingleColorQuery.CONTAINER_LOW});

FractionBasedBorderPainter outerBorderPainter = new FractionBasedBorderPainter(
FractionBasedTonalBorderPainter outerBorderPainter = new FractionBasedTonalBorderPainter(
"Office Silver 2007 Outer", new float[] {0.0f, 0.5f, 1.0f},
new ColorSchemeSingleColorQuery[] {
ColorSchemeSingleColorQuery.LIGHT,
ColorSchemeSingleColorQuery.ULTRADARK,
ColorSchemeSingleColorQuery.MID});
RadianceBorderPainter innerBorderPainter = new DelegateFractionBasedBorderPainter(
new ContainerColorTokensSingleColorQuery[] {
ContainerColorTokensSingleColorQuery.CONTAINER_LOW,
ContainerColorTokensSingleColorQuery.CONTAINER_HIGHEST,
ContainerColorTokensSingleColorQuery.CONTAINER
});
RadianceBorderPainter innerBorderPainter = new DelegateFractionBasedTonalBorderPainter(
"Office Silver 2007 Inner", outerBorderPainter,
new int[] {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
scheme -> scheme.tint(0.8f));
scheme -> ColorSchemeUtils.tint(scheme, 0.8f));
this.borderPainter = new CompositeBorderPainter("Office Silver 2007",
outerBorderPainter, innerBorderPainter);

this.decorationPainter = new FractionBasedDecorationPainter(
this.decorationPainter = new FractionBasedTonalDecorationPainter(
"Office Silver 2007",
new float[] {0.0f, 0.2499999f, 0.25f, 0.3f, 0.7f, 1.0f},
new ColorSchemeSingleColorQuery[] {
ColorSchemeSingleColorQuery.ULTRALIGHT,
ColorSchemeSingleColorQuery.EXTRALIGHT,
ColorSchemeSingleColorQuery.DARK,
ColorSchemeSingleColorQuery.MID,
ColorSchemeSingleColorQuery.LIGHT,
ColorSchemeSingleColorQuery.ULTRALIGHT});

this.highlightFillPainter = new ClassicFillPainter();
new ContainerColorTokensSingleColorQuery[] {
ContainerColorTokensSingleColorQuery.CONTAINER_LOWEST,
ContainerColorTokensSingleColorQuery.CONTAINER_LOW,
ContainerColorTokensSingleColorQuery.CONTAINER_HIGH,
ContainerColorTokensSingleColorQuery.CONTAINER,
ContainerColorTokensSingleColorQuery.CONTAINER_LOW,
ContainerColorTokensSingleColorQuery.CONTAINER_LOWEST});

this.highlightFillPainter = new ClassicTonalFillPainter();
}

@Override
Expand Down
Loading

0 comments on commit 4be2e72

Please sign in to comment.