-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH: Add ability to style axis names with Styler #48972
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
Changes from 11 commits
c85e074 6221501 fa019f6 7484e07 f2e091b c36bf24 9196591 f8619a4 ae28dbc ad0d26c f1556ee 4589d1b 5d84097 0dbf0b7 38e5665 e10a5db ee5ecb1 5c5bc1b 3d98d33 03bcd37 2d36941 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| | @@ -63,6 +63,10 @@ class CSSDict(TypedDict): | |||||
| | ||||||
| CSSStyles = List[CSSDict] | ||||||
| Subset = Union[slice, Sequence, Index] | ||||||
| # Maps styles to list of cell element id's that have that style | ||||||
| CellMapStyles = DefaultDict[Tuple[CSSPair, ...], List[str]] | ||||||
| # Maps cell positions to CSS styles | ||||||
| CSSCellMap = DefaultDict[Tuple[int, int], CSSList] | ||||||
| | ||||||
| | ||||||
| class StylerRenderer: | ||||||
| | @@ -110,6 +114,7 @@ def __init__( | |||||
| "row_heading": "row_heading", | ||||||
| "col_heading": "col_heading", | ||||||
| "index_name": "index_name", | ||||||
| "columns_name": "columns_name", | ||||||
| ||||||
| "columns_name": "columns_name", | |
| "col_name": "col_name", |
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.
column_name = [ _element( "th", ( f"{self.css['blank']} {self.css['level']}{r}" if name is None else f"{self.css['columns_name']} {self.css['level']}{r}" ), name if (name is not None and not self.hide_column_names) else self.css["blank_value"], not all(self.hide_index_), ) ]Is this a breaking change? For column level names, it removes the index_name class and adds in the columns_names class in it's place. If users were purposefully doing styles with .index_name selectors with the intention of applying those to column level names, it will break that behavior.
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.
Well it will break the example in the user guide because that styles class index_name.
However, this should be an easy fix:
index_names = { 'selector': '.index_name, .col_name', 'props': 'font-style: italic; color: darkgrey; font-weight:normal;' } As long as this break is documented I think including the additional functionality is worth it in long run.
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.
is this following the same pattern as above?
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.