Skip to content

Enhancement: Improve component theme functions #15443

Open
37 of 37 issues completed
Open
37 of 37 issues completed
@simeonoff

Description

@simeonoff

Improve the internal logic for component themes so that we can get better computed colors for the various states (hover, active, focus, etc.) based off of the base colors passed.

For instance, given a specific background for the contained button, scale all of its other state colors internally, if not explicitly provided by the creator of the theme, so that we can achieve better end-result consistent with the base color.

The colors should attempt to scale the base color in a similar fashion to the original theme colors.

Example:

$my-button-theme: button-theme(
    $background: red
);

This will result in a Sass map that contains all related values generated from the base color. For example the $focus-background can be calculated using an approach similar to this:

@if not($focus-background) and $background {
    $focus-background: oklch(from $background calc(l * 1.5)h s );
}

Since the $focus-background will now be available, the $focus-foreground can automatically be derived from it.

@if not($focus-foreground) and $focus-background {
    $focus-foreground: adaptive-contrast($focus-background);
}

Sub-issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions