Compare commits

..

8 Commits

Author SHA1 Message Date
stereobooster 4754d31893
Merge 954fd7fac9 into 05c3fef94a 2023-11-26 15:42:46 +11:00
James Panther 05c3fef94a
🔨 Preparing release v2.7.6 2023-11-26 15:41:00 +11:00
stereobooster 954fd7fac9 potential solution to screenshot 2023-11-26 02:23:34 +01:00
stereobooster 06195bc379 use original image as backup for srcset 2023-11-26 02:02:09 +01:00
James Panther 6e4ace75f8
🐛 Fix mermaid diagram dark mode styling
Fixes #706
2023-11-26 11:43:02 +11:00
stereobooster b592a81d46 do not upscale images in picture shortcode 2023-11-26 01:21:36 +01:00
stereobooster 6f0d70ee36 integrate in single.html 2023-11-26 00:31:42 +01:00
stereobooster 3ef388f4f6 Example of integration of picture partial 2023-11-26 00:31:42 +01:00
9 changed files with 83 additions and 31 deletions

View File

@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] ## [Unreleased]
## [2.7.6] - 2023-11-26
### Fixed
- Some Mermaid diagram elements not styled correctly in dark mode ([#706](https://github.com/jpanther/congo/issues/706))
## [2.7.5] - 2023-11-25 ## [2.7.5] - 2023-11-25
### Added ### Added
@ -797,7 +803,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Advanced customisation using simple Tailwind colour definitions and styles - Advanced customisation using simple Tailwind colour definitions and styles
- Fully documented - Fully documented
[Unreleased]: https://github.com/jpanther/congo/compare/v2.7.5...HEAD [Unreleased]: https://github.com/jpanther/congo/compare/v2.7.6...HEAD
[2.7.6]: https://github.com/jpanther/congo/compare/v2.7.5...v2.7.6
[2.7.5]: https://github.com/jpanther/congo/compare/v2.7.4...v2.7.5 [2.7.5]: https://github.com/jpanther/congo/compare/v2.7.4...v2.7.5
[2.7.4]: https://github.com/jpanther/congo/compare/v2.7.3...v2.7.4 [2.7.4]: https://github.com/jpanther/congo/compare/v2.7.3...v2.7.4
[2.7.3]: https://github.com/jpanther/congo/compare/v2.7.2...v2.7.3 [2.7.3]: https://github.com/jpanther/congo/compare/v2.7.2...v2.7.3

View File

@ -1,4 +1,4 @@
/*! Congo v2.7.5 | MIT License | https://github.com/jpanther/congo */ /*! Congo v2.7.6 | MIT License | https://github.com/jpanther/congo */
/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com */ /*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com */

View File

@ -1,4 +1,4 @@
/*! Congo v2.7.5 | MIT License | https://github.com/jpanther/congo */ /*! Congo v2.7.6 | MIT License | https://github.com/jpanther/congo */
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;

View File

@ -2,19 +2,29 @@ function css(name) {
return "rgb(" + getComputedStyle(document.documentElement).getPropertyValue(name) + ")"; return "rgb(" + getComputedStyle(document.documentElement).getPropertyValue(name) + ")";
} }
let isDark = document.documentElement.classList.contains("dark");
mermaid.initialize({ mermaid.initialize({
theme: "base", theme: "base",
themeVariables: { themeVariables: {
background: css("--color-neutral"), background: css("--color-neutral"),
primaryColor: css("--color-primary-200"), primaryTextColor: isDark ? css("--color-neutral-200") : css("--color-neutral-700"),
secondaryColor: css("--color-secondary-200"), primaryColor: isDark ? css("--color-primary-700") : css("--color-primary-200"),
tertiaryColor: css("--color-neutral-100"), secondaryColor: isDark ? css("--color-secondary-700") : css("--color-secondary-200"),
primaryBorderColor: css("--color-primary-400"), tertiaryColor: isDark ? css("--color-neutral-700") : css("--color-neutral-100"),
primaryBorderColor: isDark ? css("--color-primary-500") : css("--color-primary-400"),
secondaryBorderColor: css("--color-secondary-400"), secondaryBorderColor: css("--color-secondary-400"),
tertiaryBorderColor: css("--color-neutral-400"), tertiaryBorderColor: isDark ? css("--color-neutral-300") : css("--color-neutral-400"),
lineColor: css("--color-neutral-600"), lineColor: isDark ? css("--color-neutral-300") : css("--color-neutral-600"),
fontFamily: fontFamily:
"ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif", "ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif",
fontSize: "16px", fontSize: "16px",
pieTitleTextSize: "19px",
pieSectionTextSize: "16px",
pieLegendTextSize: "16px",
pieStrokeWidth: "1px",
pieOuterStrokeWidth: "0.5px",
pieStrokeColor: isDark ? css("--color-neutral-300") : css("--color-neutral-400"),
pieOpacity: "1",
}, },
}); });

View File

@ -10,9 +10,17 @@
{{ $img = resources.Get $path }} {{ $img = resources.Get $path }}
{{ end -}} {{ end -}}
{{/* https://github.com/gohugoio/hugo/pull/10666/files */}}
{{- $params := $url.Query -}}
{{- $x2Param := $params.Get "x2" -}}
{{- $x2 := false -}}
{{- if eq $x2Param "true" -}}
{{- $x2 = true -}}
{{- end -}}
<figure> <figure>
{{- with $img -}} {{- with $img -}}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }} {{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }}
{{- else -}} {{- else -}}
<img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/> <img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/>
{{- end -}} {{- end -}}

View File

@ -4,6 +4,7 @@
{{ $lazy := .lazy }} {{ $lazy := .lazy }}
{{ $webp := .webp }} {{ $webp := .webp }}
{{ $lqip := .lqip }} {{ $lqip := .lqip }}
{{ $x2 := .x2 | default false }}
{{ with $img }} {{ with $img }}
{{ if (eq .MediaType.SubType "svg") }} {{ if (eq .MediaType.SubType "svg") }}
@ -45,6 +46,12 @@
style="background-image:url(data:image/webp;base64,{{ $bg }});background-size:cover" style="background-image:url(data:image/webp;base64,{{ $bg }});background-size:cover"
{{ end }} {{ end }}
> >
{{ $width := .Width }}
{{ $height := .Height }}
{{ if $x2 }}
{{ $width = div .Width 2 }}
{{ $height = div .Height 2 }}
{{ end }}
{{ if $webp }} {{ if $webp }}
<source <source
{{ if lt .Width 660 }} {{ if lt .Width 660 }}
@ -54,9 +61,21 @@
{{ else }} {{ else }}
srcset=" srcset="
{{- (.Resize "330x webp").RelPermalink }} 330w, {{- (.Resize "330x webp").RelPermalink }} 330w,
{{- (.Resize "660x webp").RelPermalink }} 660w, {{- (.Resize "660x webp").RelPermalink }} 660w
{{- (.Resize "1024x webp").RelPermalink }} 1024w, {{ if gt .Width 1024 }}
{{- (.Resize "1320x webp").RelPermalink }} 2x" ,{{ (.Resize "1024x webp").RelPermalink }} 1024w
{{ else }}
{{ with .Resize (printf "%dx%d webp" .Width .Height) }}
,{{ .RelPermalink }} {{ .Width }}w
{{ end }}
{{ end }}
{{ if gt .Width 1320 }}
,{{ (.Resize "1320x webp").RelPermalink }} 2x
{{ else }}
{{ with .Resize (printf "%dx%d webp" .Width .Height) }}
,{{ .RelPermalink }} {{ .Width }}w
{{ end }}
{{ end }}"
src="{{ (.Resize "660x webp").RelPermalink }}" src="{{ (.Resize "660x webp").RelPermalink }}"
{{ end }} {{ end }}
type="image/webp" type="image/webp"
@ -64,8 +83,8 @@
{{ end }} {{ end }}
<img <img
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
width="{{ .Width }}" width="{{ $width }}"
height="{{ .Height }}" height="{{ $height }}"
{{ with $class }} class="{{ . }}" {{ end }} {{ with $class }} class="{{ . }}" {{ end }}
{{ with $alt }} alt="{{ . }}" {{ end }} {{ with $alt }} alt="{{ . }}" {{ end }}
{{ with $lazy }} loading="lazy" decoding="async" {{ end }} {{ with $lazy }} loading="lazy" decoding="async" {{ end }}
@ -74,9 +93,17 @@
{{ else }} {{ else }}
srcset=" srcset="
{{- (.Resize "330x").RelPermalink }} 330w, {{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w, {{- (.Resize "660x").RelPermalink }} 660w
{{- (.Resize "1024x").RelPermalink }} 1024w, {{ if gt .Width 1024 }}
{{- (.Resize "1320x").RelPermalink }} 2x" ,{{ (.Resize "1024x").RelPermalink }} 1024w
{{ else }}
,{{ .RelPermalink }} {{ .Width }}w
{{ end }}
{{ if gt .Width 1320 }}
,{{ (.Resize "1320x").RelPermalink }} 2x
{{ else }}
,{{ .RelPermalink }} {{ .Width }}w
{{ end }}"
src="{{ (.Resize "660x").RelPermalink }}" src="{{ (.Resize "660x").RelPermalink }}"
{{ end }} {{ end }}
> >

View File

@ -4,4 +4,5 @@
{{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }} {{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := $.Page.Site.Params.enableImageWebp | default true }} {{ $webp := $.Page.Site.Params.enableImageWebp | default true }}
{{ $lqip := false }} {{ $lqip := false }}
{{ partial "picture.html" (dict "img" $img "alt" $alt "class" $class "lazy" $lazy "webp" $webp "lqip" $lqip) }} {{ $x2 := .x2 }}
{{ partial "picture.html" (dict "img" $img "alt" $alt "class" $class "lazy" $lazy "webp" $webp "lqip" $lqip "x2" $x2) }}

View File

@ -4,17 +4,16 @@
{{- if .Get "href" -}} {{- if .Get "href" -}}
<a href="{{ .Get "href" }}"> <a href="{{ .Get "href" }}">
{{- end -}} {{- end -}}
<img src="{{ $image.RelPermalink }}"
{{- if or (.Get "alt") (.Get "caption") }} {{ $altText := "" }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}" {{ with .Get "alt" }}
{{- end -}} {{ $altText = . }}
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ else }}
loading="lazy" {{ $altText = (.Get "caption") | markdownify | plainify }}
{{ end }} {{ end }}
width="100%"
height="auto" {{ partial "pictureDefaults.html" (dict "img" $image "alt" $altText "x2" true) }}
style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;"
/>
{{- if .Get "href" }}</a>{{ end -}} {{- if .Get "href" }}</a>{{ end -}}
{{- if .Get "caption" -}} {{- if .Get "caption" -}}
<figcaption> <figcaption>

View File

@ -1,6 +1,6 @@
{ {
"name": "hugo-congo-theme", "name": "hugo-congo-theme",
"version": "2.7.5", "version": "2.7.6",
"description": "Congo theme for Hugo", "description": "Congo theme for Hugo",
"scripts": { "scripts": {
"preinstall": "rimraf assets/lib", "preinstall": "rimraf assets/lib",