Skip to content
Open
Show file tree
Hide file tree
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
120 changes: 0 additions & 120 deletions libs/design/scss/theming/_configure-theme.scss

This file was deleted.

3 changes: 0 additions & 3 deletions libs/design/scss/theming/_get-palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,5 @@
) {
@error '' + $palette + ' is not a supported palette in Daffodil`s theme configurations.';
}
@if ($palette == 'neutral') {
@return map-get.daff-map-get($theme, 'core', $palette);
}
@return map-get.daff-map-get($theme, $palette);
}
1 change: 0 additions & 1 deletion libs/design/scss/theming/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
@forward 'get-palette';
@forward 'get-base-color';
@forward 'get-theme-mode';
@forward 'configure-theme' show daff-configure-theme;
2 changes: 1 addition & 1 deletion libs/design/scss/theming/_theme-css-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
--daff-theme-black: #{$black};
--daff-theme-gray: #{daff-color($neutral)};
--daff-base-bg: #{$base};
--daff-base-text: #{daff-text-contrast($base)};
--daff-base-text: #{core.daff-map-get($theme, 'text-color-default')};
}

@mixin daff-theme-css-variables($theme) {
Expand Down
4 changes: 2 additions & 2 deletions libs/design/scss/theming/create-theme/_create-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ $supported-theme-modes: (
/// $critical: configure-palette.daff-configure-palette(palette.$daff-red, 60);
/// $success: configure-palette.daff-configure-palette(palette.$daff-green, 60);
/// $neutral: configure-palette.daff-configure-palette(palette.$daff-neutral, 60);
/// $text-color-default: get-color.daff-color(palette.$daff-neutral, 10);
/// $text-color-inverse: get-color.daff-color(palette.$daff-neutral, 100);
/// $text-color-default: get-color.daff-color(palette.$daff-neutral, 100);
/// $text-color-inverse: get-color.daff-color(palette.$daff-neutral, 10);
/// $theme: daff-create-theme((
/// 'mode': 'light',
/// 'primary': $primary,
Expand Down
32 changes: 7 additions & 25 deletions libs/design/scss/theming/get-font-colors/_get-font-colors.scss
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
@use 'sass:map';
@use 'sass:list';
@use '../get-base-color' as *;

/// Returns a light and dark color.
/// @access private
///
/// If you are not using Daffodil's default theme, a theme **must** be
/// created with `daff-create-theme` before this function can be used.
/// See the [customize your own theme](daff.io/docs/design/theming/customize-your-own-theme)
/// guide for more information.
/// Returns a theme's default and inverse text colors as a contrast pair.
///
/// @group Theming
/// Which of the two is the lighter color depends on the theme mode, so callers
/// should treat the list as `(default, inverse)` rather than `(light, dark)`.
///
/// @param {Map} $theme — A theme map created with the `daff-create-theme` function.
///
/// @return {List} — Returns a list of colors
///
/// @example scss
/// @use '@daffodil/design/scss/theme' as daff-theme;
///
/// @mixin custom-content-theme($theme) {
/// $availableColors: daff-theme.daff-get-font-colors($theme);
/// }
///
/// @return {List} — The theme's `text-color-default` and `text-color-inverse`.
@function daff-get-font-colors($theme) {
@if (map.get($theme, 'text-color-default')) {
@return (
map.get($theme, 'text-color-default'),
map.get($theme, 'text-color-inverse')
);
}
@return (
daff-get-base-color($theme, 'white'),
daff-get-base-color($theme, 'black')
map.get($theme, 'text-color-default'),
map.get($theme, 'text-color-inverse')
);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@use 'true' as *;
@use 'sass:list';
@use 'sass:map';
@use '../create-theme' as *;
@use '../color-palettes' as palette;
@use '../configure-palette';
@use '../get-color';
@use '../get-base-color' as *;
@use './get-font-colors' as *;
@use '../configure-theme' as ct;

@include describe('daff-get-font-colors') {
$primary: configure-palette.daff-configure-palette(palette.$daff-blue, 60);
Expand All @@ -17,8 +14,6 @@
$font-dark: get-color.daff-color(palette.$daff-neutral, 100);
$default-dark: palette.$black;
$default-light: palette.$white;
$white: palette.$white;
$black: palette.$black;

@include it('returns theme text colors when provided') {
$config: (
Expand Down Expand Up @@ -62,11 +57,4 @@
@include assert-equal(list.nth($colors, 1), $font-light);
@include assert-equal(list.nth($colors, 2), $default-dark);
}

@include it('returns base colors when theme map is created with daff-configure-theme instead of daff-create-theme') {
$theme: ct.daff-configure-theme($primary, $secondary, $tertiary, 'light');
$colors: daff-get-font-colors($theme);
@include assert-equal(list.nth($colors, 1), $white);
@include assert-equal(list.nth($colors, 2), $black);
}
}
Loading