Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove specificity on text coloring #770

Merged
merged 4 commits into from
May 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Added `isLoading` prop to `EuiButtonEmpty` ([#768](https://github.com/elastic/eui/pull/768))
- Removed individual badge cross icon when `EuiComboBox` has `singleSelection` prop enabled. ([#769](https://github.com/elastic/eui/pull/769))

**Bug fixes**

- Removed specificity on `EuiText` that was causing cascade conflicts around text coloring. ([#770](https://github.com/elastic/eui/pull/770))

## [`0.0.45`](https://github.com/elastic/eui/tree/v0.0.45)

- Added `EuiBetaBadge` for non-GA labelling including options to add it to `EuiCard` and `EuiKeyPadMenuItem` ([#705](https://github.com/elastic/eui/pull/705))
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/text/text_color.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default () => (
<p>
Sometimes you need to color entire blocks of text, no matter what is in them.
You can always apply color directly (versus using the separated component) to
make it easy.
make it easy. Links should still <a href="#">properly color</a>.
</p>
</EuiText>
</div>
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/text/text_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ export const TextExample = {
There are two ways to color text. Either individually by
applying <EuiCode>EuiTextColor</EuiCode> on individual text objects, or
by passing the <EuiCode>color</EuiCode> prop directly on <EuiCode>EuiText</EuiCode> for
a blanket approach across the entirely of your text. Either solution wraps
the element in a span with the <EuiCode>!important</EuiCode> applied to the color.
It will override any other colors in use, so be careful.
a blanket approach across the entirely of your text.
</p>
),
props: { EuiTextColor },
Expand Down
4 changes: 4 additions & 0 deletions src/components/text/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
.euiText {
@include euiText;
@include euiFontSize;
// The euiText mixin forces a color. Since euiText is usually a child
// of other styling concerns, we should inherit their coloring. The default
// coloring will likely coming from the reset.scss anyway.
color: inherit;

a {
color: $euiLinkColor;
Expand Down
13 changes: 2 additions & 11 deletions src/components/text/_text_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,13 @@ $textColors: (

// Create color modifiers based on the map
@each $name, $color in $textColors {
.euiTextColor.euiTextColor--#{$name} {
.euiTextColor--#{$name} {

// The below function makes sure the color is accessible on our default background.
color: makeHighContrastColor($color, $euiColorEmptyShade) !important;
color: makeHighContrastColor($color, $euiColorEmptyShade);

@if $name == "ghost" {
color: $color !important;
}

// We need a blanket approach for coloring. It should overule everything.
* {
color: makeHighContrastColor($color, $euiColorEmptyShade) !important;

@if $name == "ghost" {
color: $color !important;
}
}
}
}