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

feat: add the topAppBar.coloredInDark parameter #629

Merged
merged 1 commit into from
Jul 28, 2022
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
3 changes: 3 additions & 0 deletions assets/main/scss/_config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ $font-sizes: (
xl: {{ default "1.15rem" $params.fontSize.extraLarge }},
);

// Top App Bar
$fixedHeader: {{ if $params.fixedHeader }}true{{ else }}false{{ end }};
$colored-top-app-bar-in-dark: {{ default false $params.topAppBar.coloredInDark }};

$fixedSidebar: {{ with $params.sidebar.fixed }}{{ . }}{{ else }}false{{ end }};
$backgroundImageLight: '{{ with $params.backgroundImage }}{{ index . 0 }}{{ end }}';
$backgroundImageDark: '{{ with $params.backgroundImage }}{{ if gt (len .) 1 }}{{ index . 1 }}{{ else }}{{ index . 0 }}{{ end }}{{ end }}';
Expand Down
2 changes: 1 addition & 1 deletion assets/main/scss/_palettes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $palette-classes: 'btn', 'btn-outline';
@if validate-palette($name) {
$on-primary: color-contrast($color);
$primary-secondary: shade-color($color, 20%);
$primary-tint: tint-color($color, 30%);
$primary-tint: tint-color($color, 20%);
$theme-colors: map-merge($theme-colors, ('#{$name}-tint': $primary-tint));
$on-primary-secondary: if(
$on-primary == $color-contrast-light,
Expand Down
18 changes: 10 additions & 8 deletions assets/main/scss/_top-app-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@
}
}

@include theme(dark) {
.top-app-bar {
background-color: var(--#{$prefix}surface-bg);
color: var(--#{$prefix}surface-color-secondary);
@if not $colored-top-app-bar-in-dark {
@include theme(dark) {
.top-app-bar {
background-color: var(--#{$prefix}surface-bg);
color: var(--#{$prefix}surface-color-secondary);

--#{$prefix}form-control-bg: var(--#{$prefix}surface-bg);
--#{$prefix}form-control-bg: var(--#{$prefix}surface-bg);

.offcanvas-lg {
--#{$prefix}offcanvas-bg: var(--#{$prefix}surface-bg);
--#{$prefix}offcanvas-color: var(#{$prefix}surface-color-secondary);
.offcanvas-lg {
--#{$prefix}offcanvas-bg: var(--#{$prefix}surface-bg);
--#{$prefix}offcanvas-color: var(#{$prefix}surface-color-secondary);
}
}
}
}
1 change: 1 addition & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ viewer = true # Image Viewer

[topAppBar]
# colorToggle = false # Disable the color toggle
# coloredInDark = true # Colored in dark mode
[topAppBar.social]
github = "razonyang/hugo-theme-bootstrap"
patreon = "razonyang"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The site parameters are located in `config/_default/params.toml` by default.
| `topAppBar` | Object | - |
| `topAppBar.social` | Object | - | [Social Links]({{< ref "/docs/widgets/social-links" >}}).
| `topAppBar.colorToggle` | Boolean | `true` | Turn on/off the color/mode toggle.
| `topAppBar.coloredInDark` | Boolean | `false` | Colored in dark mode.
| **Webmaster Site Verification**
| `siteVerification` | Object | - |
| `siteVerification.google` | String | - | Google
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ authors = ["RazonYang"]
| `topAppBar` | Object | - |
| `topAppBar.social` | Object | - | [社交链接]({{< ref "/docs/widgets/social-links" >}})。
| `topAppBar.colorToggle` | Boolean | `true` | 开启或禁用颜色/模式开关。
| `topAppBar.coloredInDark` | Boolean | `false` | 在深色模式下着色。
| **Webmaster Site Verification**
| `siteVerification` | Object | - |
| `siteVerification.google` | String | - | Google
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ authors = ["RazonYang"]
| `topAppBar` | Object | - |
| `topAppBar.social` | Object | - | [社交鏈接]({{< ref "/docs/widgets/social-links" >}})。
| `topAppBar.colorToggle` | Boolean | `true` | 開啟或禁用顏色/模式開關。
| `topAppBar.coloredInDark` | Boolean | `false` | 在深色模式下著色。
| **Webmaster Site Verification**
| `siteVerification` | Object | - |
| `siteVerification.google` | String | - | Google
Expand Down