Skip to content

Commit

Permalink
Add purple coloring for todo-admonitions (#2526)
Browse files Browse the repository at this point in the history
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
  • Loading branch information
fredrikekre and mortenpi authored Sep 2, 2024
1 parent 84fc937 commit e7df2bc
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* The `User-Agent` header set in the linkcheck HTTP(S) requests can now be customized with the `linkcheck_useragent` option to `makedocs`. ([#2557], [#2562])
* Admonitions with category `todo` are now colored purple. Previously they were default-colored like all other unknown admonitions categories. ([#2526])

### Changed

Expand Down Expand Up @@ -1886,6 +1887,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2499]: https://github.com/JuliaDocs/Documenter.jl/issues/2499
[#2513]: https://github.com/JuliaDocs/Documenter.jl/issues/2513
[#2514]: https://github.com/JuliaDocs/Documenter.jl/issues/2514
[#2526]: https://github.com/JuliaDocs/Documenter.jl/issues/2526
[#2549]: https://github.com/JuliaDocs/Documenter.jl/issues/2549
[#2551]: https://github.com/JuliaDocs/Documenter.jl/issues/2551
[#2557]: https://github.com/JuliaDocs/Documenter.jl/issues/2557
Expand Down
5 changes: 4 additions & 1 deletion assets/html/scss/catppuccin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $green: $catppuccin-green;
$turquoise: $catppuccin-teal;
$cyan: $catppuccin-sapphire;
$blue: $catppuccin-blue;
$purple: $catppuccin-lavender;
$purple: $catppuccin-mauve;

// Admonitions
$admonition-default: $catppuccin-subtext1;
Expand All @@ -39,6 +39,7 @@ $success: $catppuccin-green;
$warning: $catppuccin-yellow;
$danger: $catppuccin-red;
$compat: $catppuccin-sky;
$todo: $catppuccin-mauve;
// Override `default: $grey-darker` in components/_admonition.scss
$admonition-colors: (
'default': $admonition-default,
Expand All @@ -47,6 +48,7 @@ $admonition-colors: (
'warning': $warning,
'danger': $danger,
'compat': $compat,
'todo': $todo,
);
$admonition-body-color: (
'default': $catppuccin-text,
Expand All @@ -55,6 +57,7 @@ $admonition-body-color: (
'warning': $catppuccin-text,
'danger': $catppuccin-text,
'compat': $catppuccin-text,
'todo': $catppuccin-text,
);

// These would normally get initialized in _admonition.scss. However, since we are not
Expand Down
1 change: 1 addition & 0 deletions assets/html/scss/documenter-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $success: $green;
$warning: $yellow;
$danger: $red;
$compat: $cyan;
$todo: $purple;
$admonition-default: $grey-lighter;

$admonition-background: (
Expand Down
1 change: 1 addition & 0 deletions assets/html/scss/documenter-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $success: $green;
$warning: adjust-color($yellow, $hue: 2, $saturation: 10, $lightness: -24);
$danger: $red;
$compat: $cyan;
$todo: $purple;
$admonition-default: hsl(0, 0%, 29%);

// slightly increase contrast over default l: 48%
Expand Down
2 changes: 1 addition & 1 deletion assets/html/scss/documenter/components/_admonition.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Original copyright (c) 2019 Jeremy Thomas, The MIT License (MIT)
$admonition-colors: (
'default': $admonition-default, 'info': $info, 'success': $success, 'warning': $warning,
'danger': $danger, 'compat': $compat,
'danger': $danger, 'compat': $compat, 'todo': $todo,
) !default;

$admonition-background: () !default;
Expand Down
2 changes: 1 addition & 1 deletion assets/html/themes/catppuccin-frappe.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/html/themes/catppuccin-latte.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/html/themes/catppuccin-macchiato.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/html/themes/catppuccin-mocha.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/html/themes/documenter-dark.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/html/themes/documenter-light.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/latex/documenter.sty
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
\definecolor{admonition-info}{HTML}{209cee}
\definecolor{admonition-tip}{HTML}{22c35b}
\definecolor{admonition-compat}{HTML}{1db5c9}
\definecolor{admonition-todo}{HTML}{9558b2}
%

% Styling of tables.
Expand Down
4 changes: 4 additions & 0 deletions docs/src/showcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Documenter supports a range of admonition types for different circumstances.
!!! compat "'compat' admonition"
This is a `!!! compat`-type admonition.

###### TODO admonition
!!! todo "'todo' admonition"
This is a `!!! todo`-type admonition.

###### Details admonition
Admonitions with type `details` is rendered as a collapsed `<details>` block in
the HTML output, with the admonition title as the `<summary>`.
Expand Down
1 change: 1 addition & 0 deletions src/html/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ function domify(dctx::DCtx, node::Node, a::MarkdownAST.Admonition)
(a.category == "note") ? ".is-info" :
(a.category == "info") ? ".is-info" :
(a.category == "tip") ? ".is-success" :
(a.category == "todo") ? ".is-todo" :
(a.category == "compat") ? ".is-compat" : begin
# If the admonition category is not one of the standard ones, we tag the
# admonition div element with a `is-category-$(category)` class. However, we
Expand Down
2 changes: 1 addition & 1 deletion src/latex/LaTeXWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ end

function latex(io::Context, node::Node, md::MarkdownAST.Admonition)
color = "admonition-default"
if md.category in ("danger", "warning", "note", "info", "tip", "compat")
if md.category in ("danger", "warning", "note", "info", "tip", "compat", "todo")
color = "admonition-$(md.category)"
end
_print(io, "\\begin{tcolorbox}[toptitle=-1mm,bottomtitle=1mm,")
Expand Down

0 comments on commit e7df2bc

Please sign in to comment.