Skip to content

Commit

Permalink
Update allowed colors docstrings & allow grey (streamlit#7179)
Browse files Browse the repository at this point in the history
Update docstrings referencing colored text for the new colors - gray & rainbow. See PR streamlit#7106.
Also allow alternative spellings gray/grey to map to same color.
  • Loading branch information
mayagbarnes authored and zyxue committed Apr 16, 2024
1 parent 63b190e commit 621edea
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 27 deletions.
1 change: 1 addition & 0 deletions e2e/scripts/st_markdown.py
Expand Up @@ -84,6 +84,7 @@
- :violet[violet]
- :orange[orange]
- :gray[gray]
- :grey[grey]
- :rainbow[rainbow]
"""
)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -284,6 +284,7 @@ describe("StreamlitMarkdown", () => {
["violet", colors.purple80],
["orange", colors.orange100],
["gray", colors.gray80],
["grey", colors.gray80],
["rainbow", "transparent"],
])

Expand Down
Expand Up @@ -289,6 +289,7 @@ export function RenderedMarkdown({
violet: `color: ${violet}`,
orange: `color: ${orange}`,
gray: `color: ${gray}`,
grey: `color: ${gray}`,
// Gradient from red, orange, yellow, green, blue, violet, purple
rainbow: `color: transparent; background-clip: text; -webkit-background-clip: text; background-image: linear-gradient(to right,
${red}, ${orange}, ${yellow}, ${green}, ${blue}, ${violet}, ${purple});`,
Expand Down
6 changes: 3 additions & 3 deletions lib/streamlit/elements/heading.py
Expand Up @@ -65,7 +65,7 @@ def header(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
anchor : str or False
The anchor name of the header that can be accessed with #anchor
Expand Down Expand Up @@ -118,7 +118,7 @@ def subheader(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
anchor : str or False
The anchor name of the header that can be accessed with #anchor
Expand Down Expand Up @@ -174,7 +174,7 @@ def title(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
anchor : str or False
The anchor name of the header that can be accessed with #anchor
Expand Down
4 changes: 2 additions & 2 deletions lib/streamlit/elements/layouts.py
Expand Up @@ -236,7 +236,7 @@ def tabs(self, tabs: Sequence[str]) -> Sequence["DeltaGenerator"]:
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down Expand Up @@ -346,7 +346,7 @@ def expander(self, label: str, expanded: bool = False) -> "DeltaGenerator":
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
4 changes: 2 additions & 2 deletions lib/streamlit/elements/markdown.py
Expand Up @@ -56,7 +56,7 @@ def markdown(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
unsafe_allow_html : bool
By default, any HTML tags found in the body will be escaped and
Expand Down Expand Up @@ -160,7 +160,7 @@ def caption(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
unsafe_allow_html : bool
By default, any HTML tags found in strings will be escaped and
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/metric.py
Expand Up @@ -79,7 +79,7 @@ def metric(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/progress.py
Expand Up @@ -92,7 +92,7 @@ def progress(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/toast.py
Expand Up @@ -67,7 +67,7 @@ def toast(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
icon : str or None
An optional, keyword-only argument that specifies an emoji to use as
the icon for the toast. Shortcodes are not allowed, please use a
Expand Down
4 changes: 2 additions & 2 deletions lib/streamlit/elements/widgets/button.py
Expand Up @@ -93,7 +93,7 @@ def button(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down Expand Up @@ -211,7 +211,7 @@ def download_button(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/camera_input.py
Expand Up @@ -109,7 +109,7 @@ def camera_input(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
4 changes: 2 additions & 2 deletions lib/streamlit/elements/widgets/checkbox.py
Expand Up @@ -85,7 +85,7 @@ def checkbox(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down Expand Up @@ -184,7 +184,7 @@ def toggle(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/color_picker.py
Expand Up @@ -85,7 +85,7 @@ def color_picker(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/file_uploader.py
Expand Up @@ -259,7 +259,7 @@ def file_uploader(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/multiselect.py
Expand Up @@ -183,7 +183,7 @@ def multiselect(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/number_input.py
Expand Up @@ -109,7 +109,7 @@ def number_input(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/radio.py
Expand Up @@ -111,7 +111,7 @@ def radio(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/select_slider.py
Expand Up @@ -150,7 +150,7 @@ def select_slider(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/selectbox.py
Expand Up @@ -107,7 +107,7 @@ def selectbox(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
2 changes: 1 addition & 1 deletion lib/streamlit/elements/widgets/slider.py
Expand Up @@ -230,7 +230,7 @@ def slider(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
4 changes: 2 additions & 2 deletions lib/streamlit/elements/widgets/text_widgets.py
Expand Up @@ -108,7 +108,7 @@ def text_input(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down Expand Up @@ -323,7 +323,7 @@ def text_area(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down
4 changes: 2 additions & 2 deletions lib/streamlit/elements/widgets/time_widgets.py
Expand Up @@ -252,7 +252,7 @@ def time_input(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down Expand Up @@ -450,7 +450,7 @@ def date_input(
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
Unsupported elements are unwrapped so only their children (text contents) render.
Display unsupported elements as literal characters by
Expand Down

0 comments on commit 621edea

Please sign in to comment.