Skip to content

Commit 6470807

Browse files
lukasmasuchakramsystems
authored andcommitted
Hide the top colored line for custom themes (streamlit#10323)
## Describe your changes Automatically hide the top-colored line (top decoration) if a custom theme is configured and selected. ## Testing Plan - Update snapshots of custom_theme test. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
1 parent f92dadf commit 6470807

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed
-57 Bytes
Loading
-156 Bytes
Loading
-17 Bytes
Loading

frontend/app/src/App.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ interface State {
164164
gitInfo: IGitInfo | null
165165
formsData: FormsData
166166
hideTopBar: boolean
167+
hideColoredLine: boolean
167168
hideSidebarNav: boolean
168169
expandSidebarNav: boolean
169170
appPages: IAppPage[]
@@ -300,6 +301,7 @@ export class App extends PureComponent<Props, State> {
300301
// true as well for consistency.
301302
hideTopBar: true,
302303
hideSidebarNav: true,
304+
hideColoredLine: false,
303305
expandSidebarNav: false,
304306
toolbarMode: Config.ToolbarMode.MINIMAL,
305307
latestRunTime: performance.now(),
@@ -1127,6 +1129,8 @@ export class App extends PureComponent<Props, State> {
11271129
*/
11281130
setAndSendTheme = (themeConfig: ThemeConfig): void => {
11291131
this.props.theme.setTheme(themeConfig)
1132+
// Hide the colored line if a custom theme is selected:
1133+
this.setState({ hideColoredLine: !isPresetTheme(themeConfig) })
11301134
this.hostCommunicationMgr.sendMessageToHost({
11311135
type: "SET_THEME_CONFIG",
11321136
themeInfo: toExportedTheme(themeConfig.emotion),
@@ -1158,7 +1162,6 @@ export class App extends PureComponent<Props, State> {
11581162
this.setState({ themeHash })
11591163

11601164
const usingCustomTheme = !isPresetTheme(this.props.theme.activeTheme)
1161-
11621165
if (themeInput) {
11631166
const customTheme = createTheme(CUSTOM_THEME_NAME, themeInput)
11641167
// For now, users can only add one custom theme.
@@ -1870,6 +1873,7 @@ export class App extends PureComponent<Props, State> {
18701873
userSettings,
18711874
hideTopBar,
18721875
hideSidebarNav,
1876+
hideColoredLine,
18731877
expandSidebarNav,
18741878
currentPageScriptHash,
18751879
hostHideSidebarNav,
@@ -1916,7 +1920,8 @@ export class App extends PureComponent<Props, State> {
19161920
showPadding: !isEmbed() || isPaddingDisplayed(),
19171921
disableScrolling: isScrollingHidden(),
19181922
showToolbar: !isEmbed() || isToolbarDisplayed(),
1919-
showColoredLine: !isEmbed() || isColoredLineDisplayed(),
1923+
showColoredLine:
1924+
(!hideColoredLine && !isEmbed()) || isColoredLineDisplayed(),
19201925
// host communication manager elements
19211926
pageLinkBaseUrl,
19221927
sidebarChevronDownshift,

0 commit comments

Comments
 (0)