diff --git a/resources/assets/stylesheets/mixins/colors.scss b/resources/assets/stylesheets/mixins/colors.scss
index d58e4468fd1c7e89ea44aabf31a14c25d1be5288..560733f0ebe7076883267e69b89588993ba4476f 100644
--- a/resources/assets/stylesheets/mixins/colors.scss
+++ b/resources/assets/stylesheets/mixins/colors.scss
@@ -124,8 +124,8 @@ $fieldset-header: $content-color-20;
 $fieldset-border: $base-color-20;
 
 // contrast colors
-$contrast-content-white: text-contrast($content-color, #ffffff, #000000, 67%);
-$contrast-content-gray: text-contrast($content-color, $dark-gray-color, #000000 , 67%);
+$contrast-content-white: text-contrast($content-color, #ffffff, #000000);
+$contrast-content-gray: text-contrast($content-color, $dark-gray-color, #000000 , 67);
 $contrast-content-hovergray: text-contrast($content-color, $dark-gray-color-10, $dark-gray-color);
 
 $public-course-bgcolor: $red;
diff --git a/resources/assets/stylesheets/mixins/misc.scss b/resources/assets/stylesheets/mixins/misc.scss
index ef2f277296e284bd70a2466f9ed275b04b812bc1..d1f3fe67e7c53680ed3609eec12c8a40d2c4eb16 100644
--- a/resources/assets/stylesheets/mixins/misc.scss
+++ b/resources/assets/stylesheets/mixins/misc.scss
@@ -30,6 +30,6 @@
 }
 
 // https://codepen.io/kennyglenn/pen/kxqWjP
-@function text-contrast($color, $dark, $light, $threshold: 50%) {
-    @return if(lightness($color) > $threshold, $light, $dark)
+@function text-contrast($color, $dark, $light, $threshold: 51) {
+    @return if(lightness($color) < $threshold, $light, $dark)
 }
diff --git a/resources/assets/stylesheets/scss/dialog.scss b/resources/assets/stylesheets/scss/dialog.scss
index 36e666e58c2715a24969d956380becaa5f9447d6..81804ec5c8d92a2a3933780bfe896d419a6fe6cd 100644
--- a/resources/assets/stylesheets/scss/dialog.scss
+++ b/resources/assets/stylesheets/scss/dialog.scss
@@ -145,7 +145,7 @@
 
     .ui-dialog-titlebar {
         background-color: $yellow;
-        color: $contrast-content-white;
+        color: text-contrast($yellow, $black, $white);
         text-align: left;
     }
     .ui-dialog-titlebar-close {