/** * Returns the color scheme of the specified component in the specified component state. * * @param comp Component. * @param componentState Component state. * @return The color scheme of the component in the specified component state. */ public SubstanceColorScheme getColorScheme(ComponentState componentState) { SubstanceColorScheme registered = this.colorSchemeMap.get(ColorSchemeAssociationKind.FILL).get(componentState); if (registered != null) return registered; // if (componentState.isActive()) { // for now look for the best fit only on active states Map<ComponentState, ComponentState> bestFitForFill = this.bestFillMap.get(ColorSchemeAssociationKind.FILL); if (!bestFitForFill.containsKey(componentState)) { Collection<ComponentState> registeredStates = this.colorSchemeMap.get(ColorSchemeAssociationKind.FILL).keySet(); bestFitForFill.put(componentState, componentState.bestFit(registeredStates)); } ComponentState bestFit = bestFitForFill.get(componentState); if (bestFit != null) { registered = this.colorSchemeMap.get(ColorSchemeAssociationKind.FILL).get(bestFit); if (registered != null) return registered; } // } if (componentState.isFacetActive(ComponentStateFacet.PRESS)) { if (this.pressedScheme == null) { this.pressedScheme = this.activeColorScheme.shade(0.2).saturate(0.1); } return this.pressedScheme; } if (componentState == ComponentState.DISABLED_SELECTED) { if (this.disabledSelectedScheme == null) { this.disabledSelectedScheme = new BlendBiColorScheme(this.activeColorScheme, this.disabledColorScheme, 0.25); } return this.disabledSelectedScheme; } if (componentState == ComponentState.SELECTED) { if (this.selectedScheme == null) { this.selectedScheme = this.activeColorScheme.saturate(0.2); } return this.selectedScheme; } if (componentState == ComponentState.ROLLOVER_SELECTED) { if (this.rolloverSelectedScheme == null) { this.rolloverSelectedScheme = this.activeColorScheme.tint(0.1).saturate(0.1); } return this.rolloverSelectedScheme; } ComponentState hardFallback = componentState.getHardFallback(); if (hardFallback != null) return this.getColorScheme(hardFallback); if (componentState == ComponentState.ENABLED) return this.enabledColorScheme; if (componentState.isDisabled()) return this.disabledColorScheme; return this.activeColorScheme; }