Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Cleanup usage of old "isitlight" function

Henriette Darge5a6d7a78029e
diff --git a/frontend/src/global_styles/openproject/_functions.sass b/frontend/src/global_styles/openproject/_functions.sass
index 94dc926bc39..b3910df2ec9 100644
--- a/frontend/src/global_styles/openproject/_functions.sass
+++ b/frontend/src/global_styles/openproject/_functions.sass
@@ -34,6 +34,16 @@
$result: $result + rem-calc($pixel-val) + ' '
@return #{$result}
+/// Taken from Foundation for Apps
+/// Is Light?
+/// Checks the lightness of $color, and if it passes the $threshold of lightness, it returns the `$yes` color. Otherwise, it returns the `$no` color. Use this function to dynamically output a foreground color based on a given background color.
+///
+/// @param {color} $color - Color to check the lightness of.
+/// @param {color} $yes - Color to return if $color is light.
+/// @param {color} $no - Color to return if $color is dark.
+/// @param {percentage} $threshold - Threshold of lightness to check against.
+///
+/// @return The $yes color or $no color.
@function is-light($color, $yes: #000, $no: #fff, $threshold: 60%)
@if (lightness($color) > $threshold)
@return $yes
diff --git a/frontend/src/global_styles/openproject/_settings.scss b/frontend/src/global_styles/openproject/_settings.scss
index b17bad36253..5b28d7c6fb5 100644
--- a/frontend/src/global_styles/openproject/_settings.scss
+++ b/frontend/src/global_styles/openproject/_settings.scss
@@ -267,8 +267,8 @@ $button-radius: 2px;
// $accordion-title-background: $gray-light;
// $accordion-title-background-hover: smartscale($accordion-title-background, 5%);
// $accordion-title-background-active: smartscale($accordion-title-background, 3%);
-// $accordion-title-color: isitlight($accordion-title-background);
-// $accordion-title-color-active: isitlight($accordion-title-background);
+// $accordion-title-color: is-light($accordion-title-background);
+// $accordion-title-color-active: is-light($accordion-title-background);
// $accordion-title-padding: $global-padding;
// $accordion-content-padding: $global-padding;
@@ -299,7 +299,7 @@ $button-radius: 2px;
// $blocklist-fontsize: 1rem;
// $blocklist-item-padding: 0.8rem 1rem;
-// $blocklist-item-color: isitlight($blocklist-background, #000, #fff);
+// $blocklist-item-color: is-light($blocklist-background, #000, #fff);
// $blocklist-item-background-hover: smartscale($blocklist-background, 4.5%);
// $blocklist-item-color-disabled: #999;
// $blocklist-item-border: 1px solid smartscale($blocklist-background, 18.5%);
@@ -324,7 +324,7 @@ $button-radius: 2px;
// - - - - - - - - - - - - - - -
$card-background: #fff;
-$card-color: isitlight($card-background);
+$card-color: is-light($card-background);
$card-border: 1px solid;
$card-radius: 0;
$card-shadow: none;
@@ -428,7 +428,7 @@ $label-color: var(--gray-dark);
// $menubar-background: #fff;
// $menubar-background-hover: smartscale($menubar-background, 7%);
// $menubar-background-active: $menubar-background-hover;
-// $menubar-color: isitlight($menubar-background);
+// $menubar-color: is-light($menubar-background);
// $menubar-color-hover: $menubar-color;
// $menubar-color-active: $menubar-color-hover;
@@ -541,7 +541,7 @@ $label-color: var(--gray-dark);
// $offcanvas-size-vertical: 250px;
// $offcanvas-background: #fff;
-// $offcanvas-color: isitlight($offcanvas-background);
+// $offcanvas-color: is-light($offcanvas-background);
// $offcanvas-padding: 0;
// $offcanvas-shadow: 3px 0 10px rgba(black, 0.25);
// $offcanvas-animation-speed: 0.25s;
@@ -592,7 +592,7 @@ $label-color: var(--gray-dark);
// $tab-title-background: $gray-light;
// $tab-title-background-hover: smartscale($tab-title-background, 5%);
// $tab-title-background-active: smartscale($tab-title-background, 3%);
-// $tab-title-color: isitlight($tab-title-background);
+// $tab-title-color: is-light($tab-title-background);
// $tab-title-color-active: $tab-title-color;
// $tab-title-padding: $global-padding;
diff --git a/frontend/src/global_styles/vendor/foundation-apps/scss/components/_forms.scss b/frontend/src/global_styles/vendor/foundation-apps/scss/components/_forms.scss
index 9a88170e1e4..558ed581e82 100755
--- a/frontend/src/global_styles/vendor/foundation-apps/scss/components/_forms.scss
+++ b/frontend/src/global_styles/vendor/foundation-apps/scss/components/_forms.scss
@@ -225,7 +225,7 @@ select {
$top-padding: get-side($form-padding, top);
$bottom-padding: get-side($form-padding, bottom);
$height: ($form-fontsize * 1.4) + $top-padding + $bottom-padding;
- $color: isitlight($select-background);
+ $color: is-light($select-background);
@include no-appearance;
display: block;
diff --git a/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_functions.scss b/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_functions.scss
index a2e34a27e5e..2db60f8ec0e 100755
--- a/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_functions.scss
+++ b/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_functions.scss
@@ -3,8 +3,8 @@
// foundation.zurb.com
// Licensed under MIT Open Source
-@use "sass:math";
-
+@use "sass:math";
+
$include-css: () !default;
$modules: () !default;
$rem-base: 16px !default;
@@ -102,24 +102,6 @@ $rem-base: 16px !default;
}
}
-/// Is It Light?
-/// Checks the lightness of $color, and if it passes the $threshold of lightness, it returns the `$yes` color. Otherwise, it returns the `$no` color. Use this function to dynamically output a foreground color based on a given background color.
-///
-/// @param {color} $color - Color to check the lightness of.
-/// @param {color} $yes - Color to return if $color is light.
-/// @param {color} $no - Color to return if $color is dark.
-/// @param {percentage} $threshold - Threshold of lightness to check against.
-///
-/// @return The $yes color or $no color.
-@function isitlight($color, $yes: #000, $no: #fff, $threshold: 60%) {
- @if (lightness($color) > $threshold) {
- @return $yes;
- }
- @else {
- @return $no;
- }
-}
-
/// Smart Scale
/// Scales a color to be lighter if it's light, or darker if it's dark. Use this function to "fade" a color appropriate to its lightness.
///