-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Styling: Add more semantic color slots #1901
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1d9ad60
add more semantic color slots
phkuo fb17bcd
add chang efile
phkuo 5e34c55
add documentation
phkuo b9631bd
address code review feedback
phkuo e9d4ce9
Merge branch 'master' into phkuo/glamor
phkuo 00916d0
Merge branch 'master' into phkuo/glamor
phkuo 8fb8c54
Update phkuo-glamor_2017-05-31-22-58.json
dzearing 7f7aeb8
Merge branch 'master' into phkuo/glamor
phkuo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
common/changes/@uifabric/styling/phkuo-glamor_2017-05-31-22-58.json
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,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@uifabric/styling", | ||
"comment": "add more semantic color slots", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@uifabric/styling", | ||
"email": "[email protected]" | ||
} |
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 |
---|---|---|
@@ -1,31 +1,147 @@ | ||
/** | ||
* | ||
* The collection of semantic slots for colors used in themes. | ||
* See documentation [todo] | ||
*/ | ||
|
||
Naming Convention | ||
The name of a semantic slot can quickly tell you how it’s meant to be used. It generally follows this format: | ||
[category name][element name][checked state][hovered/pressed/disabled state] | ||
[category name] – The “family” that this slot belongs to. | ||
[element name] – The name of the thing being targeted, such as the background or border. | ||
[checked state] – Whether the thing is checked. We assume things are unchecked by default, so no need to specify the unchecked state. | ||
(We used “checked” to refer to anything that is on, selected, toggled, highlighted, emphasized, etc.) | ||
[hovered/pressed/disabled state] – One of these states, if applicable. Each of these states are mutually exclusive. | ||
Pressed styles overwrite hovered styles, and disabled elements cannot be hovered or pressed. | ||
|
||
Base/Body | ||
A basic set of slots that provide many default body styles, such as text, subtext, disabled colors, error text, and so on. | ||
If a category doesn't provide the slot you're looking for, use one from this category. | ||
For example, the placeholder text on a text input field has no corresponding slot in its category, | ||
so you'd use the bodySubtextColor from this category. | ||
|
||
Input Controls | ||
This category contains input components commonly used to denote state, including radio buttons, | ||
check boxes, toggle switches, sliders, progress bars, and more. | ||
|
||
Menus | ||
Any kind of popup menus uses this category. | ||
|
||
Lists | ||
Lists differ from menus in that they are designed to show infinite amounts of items, often scroll, | ||
and have a large and complex interaction surface. | ||
This category covers all kinds of lists, whether they're typical one-item-per-row lists (like DetailsList) or ones with a tiled layout. | ||
|
||
*/ | ||
export interface ISemanticColors { | ||
/* ANY ADDITIONS/REMOVALS HERE MUST ALSO BE MADE TO \packages\styling\src\utilities\theme.ts:_makeSemanticColorsFromPalette() */ | ||
|
||
/** | ||
* ANY ADDITIONS/REMOVALS HERE MUST ALSO BE MADE TO \packages\styling\src\utilities\theme.ts:_makeSemanticColorsFromPalette() | ||
* The default color for backgrounds. | ||
*/ | ||
|
||
// Base slots defining universal colors | ||
bodyBackground?: string; | ||
/** | ||
* The default color for text. | ||
*/ | ||
bodyText?: string; | ||
/** | ||
* De-emphasized text; e.g. metadata, captions, placeholder text. | ||
*/ | ||
bodySubtext?: string; | ||
/** | ||
* Divider lines; e.g. lines that separate sections in a menu, an <HR> element. | ||
*/ | ||
bodyDivider?: string; | ||
|
||
/** | ||
* The default color for backgrounds of disabled controls; e.g. disabled text field. | ||
*/ | ||
disabledBackground?: string; | ||
/** | ||
* The default color for disabled text; e.g. user input inside a disabled text field. | ||
*/ | ||
disabledText?: string; | ||
/** | ||
* Disabled de-emphasized text; e.g. placeholder text inside disabled input field. | ||
*/ | ||
disabledSubtext?: string; | ||
|
||
/** | ||
* The color of the outline around focused controls that don't already have a border; e.g. menu items | ||
*/ | ||
focusBorder?: string; | ||
|
||
// Invariants - slots that rarely change color theme-to-theme because the color has meaning | ||
/** | ||
* The background for errors, if necessary, or highlighting the section of the page where the error is present. | ||
*/ | ||
errorBackground?: string; | ||
/** | ||
* The default color of error text. | ||
*/ | ||
errorText?: string; | ||
|
||
// Input controls slots (text fields, checkboxes, radios...) | ||
/** | ||
* The border of an input control in its resting, unchecked state; e.g. the box of an unchecked checkbox. | ||
*/ | ||
inputBorder?: string; | ||
/** | ||
* The border color of a hovered input control. | ||
*/ | ||
inputBorderHovered?: string; | ||
inputBackgroundSelected?: string; | ||
inputBackgroundSelectedHovered?: string; | ||
inputForegroundSelected?: string; | ||
/** | ||
* The background of a checked control; e.g. checked radio button's dot, checked toggle's background. | ||
*/ | ||
inputBackgroundChecked?: string; | ||
/** | ||
* The background of a checked and hovered control; e.g. checked checkbox's background color on hover. | ||
*/ | ||
inputBackgroundCheckedHovered?: string; | ||
/** | ||
* The foreground of a checked control; e.g. checked checkbox's checkmark color, checked toggle's thumb color, radio button's background color around the dot. | ||
*/ | ||
inputForegroundChecked?: string; | ||
/** | ||
* The alternate focus border color for elements that already have a border; e.g. text field borders on focus. | ||
*/ | ||
inputFocusBorderAlt?: string; | ||
|
||
// Menus, popups, etc | ||
/** | ||
* The background of a hovered menu item. | ||
*/ | ||
menuItemBackgroundHovered?: string; | ||
/** | ||
* The background of checked menu item; e.g. a menu item whose submenu is open, a selected dropdown item. | ||
*/ | ||
menuItemBackgroundChecked?: string; | ||
/** | ||
* The default colors of icons in menus. | ||
*/ | ||
menuIcon?: string; | ||
/** | ||
* The headers in menus that denote title of a section. | ||
*/ | ||
menuHeader?: string; | ||
|
||
// Lists | ||
/** | ||
* The background color for the entire list. | ||
*/ | ||
listBackground?: string; | ||
/** | ||
* The default text color for list item titles and text in column fields. | ||
*/ | ||
listTextColor?: string; | ||
/** | ||
* The background color of a hovered list item. | ||
*/ | ||
listItemBackgroundHovered?: string; | ||
/** | ||
* The background color of a checked list item. | ||
*/ | ||
listItemBackgroundChecked?: string; | ||
/** | ||
* The background color of a checked and hovered list item. | ||
*/ | ||
listItemBackgroundCheckedHovered?: 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think each of these should have a simple comment explaining what scenario its used in. Otherwise the consumer has to solely rely on the name of the variable.