-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: input's adornment and helper disabled colors (#3726)
- Loading branch information
1 parent
43a9b17
commit 252b1a6
Showing
15 changed files
with
146 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import color from 'color'; | ||
|
||
import type { InternalTheme } from '../../types'; | ||
|
||
type BaseProps = { | ||
theme: InternalTheme; | ||
disabled?: boolean; | ||
type?: 'error' | 'info'; | ||
}; | ||
|
||
export function getTextColor({ theme, disabled, type }: BaseProps) { | ||
const { colors, dark } = theme; | ||
|
||
if (type === 'error') { | ||
return colors?.error; | ||
} | ||
|
||
if (theme.isV3) { | ||
if (disabled) { | ||
return theme.colors.onSurfaceDisabled; | ||
} else { | ||
return theme.colors.onSurfaceVariant; | ||
} | ||
} | ||
|
||
return color(theme?.colors?.text) | ||
.alpha(dark ? 0.7 : 0.54) | ||
.rgb() | ||
.string(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import color from 'color'; | ||
|
||
import type { InternalTheme } from '../../../types'; | ||
|
||
type BaseProps = { | ||
theme: InternalTheme; | ||
disabled?: boolean; | ||
}; | ||
|
||
export function getTextColor({ theme, disabled }: BaseProps) { | ||
if (theme.isV3) { | ||
if (disabled) { | ||
return theme.colors.onSurfaceDisabled; | ||
} | ||
return theme.colors.onSurfaceVariant; | ||
} | ||
return color(theme.colors?.text) | ||
.alpha(theme.dark ? 0.7 : 0.54) | ||
.rgb() | ||
.string(); | ||
} | ||
|
||
export function getIconColor({ theme, disabled }: BaseProps) { | ||
if (!theme.isV3) { | ||
return theme.colors.text; | ||
} | ||
|
||
if (disabled) { | ||
return theme.colors.onSurfaceDisabled; | ||
} | ||
|
||
return theme.colors.onSurfaceVariant; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.