-
-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
720a062
commit 8f8aaef
Showing
9 changed files
with
66 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,41 @@ | ||
from typing import Any | ||
|
||
from typing_extensions import get_args | ||
|
||
from ...element import Element | ||
from ...tailwind_types.background_color import BackgroundColor | ||
|
||
QUASAR_COLORS = {'primary', 'secondary', 'accent', 'dark', 'positive', 'negative', 'info', 'warning'} | ||
for color in {'red', 'pink', 'purple', 'deep-purple', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', | ||
'light-green', 'lime', 'yellow', 'amber', 'orange', 'deep-orange', 'brown', 'grey', 'blue-grey'}: | ||
QUASAR_COLORS.add(color) | ||
for i in range(1, 15): | ||
QUASAR_COLORS.add(f'{color}-{i}') | ||
|
||
TAILWIND_COLORS = get_args(BackgroundColor) | ||
|
||
|
||
class BackgroundColorElement(Element): | ||
BACKGROUND_COLOR_PROP = 'color' | ||
|
||
def __init__(self, *, background_color: str, **kwargs: Any) -> None: | ||
super().__init__(**kwargs) | ||
if background_color in QUASAR_COLORS: | ||
self._props[self.BACKGROUND_COLOR_PROP] = background_color | ||
elif background_color in TAILWIND_COLORS: | ||
self._classes.append(f'bg-{background_color}') | ||
elif background_color is not None: | ||
self._style['background-color'] = background_color | ||
|
||
|
||
class TextColorElement(Element): | ||
TEXT_COLOR_PROP = 'color' | ||
|
||
def __init__(self, *, text_color: str, **kwargs: Any) -> None: | ||
super().__init__(**kwargs) | ||
if text_color in QUASAR_COLORS: | ||
self._props[self.TEXT_COLOR_PROP] = text_color | ||
elif text_color in TAILWIND_COLORS: | ||
self._classes.append(f'text-{text_color}') | ||
elif text_color is not None: | ||
self._style['color'] = text_color |
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