Skip to content

Commit

Permalink
Renamed contrast check function
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed May 29, 2021
1 parent d7b44fb commit 97c1ad7
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -12,7 +12,7 @@ interface CSSVariable {
value: CSSVariableValue;
}

function isBestColorWhite(color: HexString): boolean {
function isWhiteHighestContrast(color: HexString): boolean {
const lightRatio = getContrastRatio(color, "#fff");
const darkRatio = getContrastRatio(color, "#000");

Expand Down Expand Up @@ -43,7 +43,7 @@ export default function useThemeVariables(
];

if (primaryColor) {
if (isBestColorWhite(primaryColor)) {
if (isWhiteHighestContrast(primaryColor)) {
variables.push({
name: "--rmd-theme-on-primary",
value: "#fff",
Expand All @@ -52,7 +52,7 @@ export default function useThemeVariables(
}

if (secondaryColor) {
if (isBestColorWhite(secondaryColor)) {
if (isWhiteHighestContrast(secondaryColor)) {
variables.push({
name: "--rmd-theme-on-secondary",
value: "#fff",
Expand Down

1 comment on commit 97c1ad7

@vercel
Copy link

@vercel vercel bot commented on 97c1ad7 May 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.