Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(design): configure defaults for status themes and add a new function that can be used to customize it #3291

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 60 additions & 2 deletions libs/design/scss/theming/_configure-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,86 @@ $supported-theme-types: (
'dark': $daff-dark-theme
);


// @docs
//
// Create a theme object given some initial settings
// Create a theme object given some initial settings.
// Sets light and dark mode defaults for `$info`, `$warn`, `$critical`, and `$success`
// that can be overriden by using the `daff-configure-theme-status` function.
//
// @usage
// ```
// daff-configure-theme($daff-yellow, $daff-blue, $daff-purple)
// $primary: configure-palette.daff-configure-palette(palette.$daff-blue, 60);
// $secondary: configure-palette.daff-configure-palette(palette.$daff-purple, 60);
// $tertiary: configure-palette.daff-configure-palette(palette.$daff-turquoise, 60);
//
// $theme: daff-configure-theme($primary, $secondary, $tertiary)
// ```
@function daff-configure-theme(
$primary,
$secondary,
$tertiary,
$type: 'light'
) {
$info: null;
$warn: null;
$critical: null;
$success: null;

@if($type == 'dark') {
$info: configure-palette.daff-configure-palette(palette.$daff-neutral, 50);
$warn: configure-palette.daff-configure-palette(palette.$daff-bronze, 50);
$critical: configure-palette.daff-configure-palette(palette.$daff-red, 50);
$success: configure-palette.daff-configure-palette(palette.$daff-green, 50);
}
@if($type == 'light') {
$info: configure-palette.daff-configure-palette(palette.$daff-neutral, 60);
$warn: configure-palette.daff-configure-palette(palette.$daff-bronze, 60);
$critical: configure-palette.daff-configure-palette(palette.$daff-red, 60);
$success: configure-palette.daff-configure-palette(palette.$daff-green, 60);
}

@return (
'primary': $primary,
'secondary': $secondary,
'tertiary': $tertiary,
'informational': $info,
'warn': $warn,
'critical': $critical,
'success': $success,
'core': daff-build-theme-core($type)
);
}

// @docs
//
// Create a status theme object given some initial settings.
//
// @usage
// ```
// $info: configure-palette.daff-configure-palette(palette.$daff-blue, 60);
// $warn: configure-palette.daff-configure-palette(palette.$daff-bronze, 60);
// $critical: configure-palette.daff-configure-palette(palette.$daff-red, 60);
// $success: configure-palette.daff-configure-palette(palette.$daff-green, 60);
//
// $theme: daff-configure-theme-status($info, $warn, $critical, $success);
// ```
@function daff-configure-theme-status(
$theme,
$warn,
$critical,
$success,
$info,
) {
@debug $theme;
@return map.merge($theme, (
'warn': $warn,
'critical': $critical,
'success': $success,
'informational': $info,
));
}

//
// @docs
//
Expand Down
Loading