Skip to content

Commit

Permalink
added support for multi-codepoint emojis
Browse files Browse the repository at this point in the history
also:
- added more samples to the theme test
- light theme tweaks
- refactoring
  • Loading branch information
marzer committed Sep 29, 2022
1 parent 96aa31c commit 882d38f
Show file tree
Hide file tree
Showing 16 changed files with 3,738 additions and 1,553 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

- added config option `gitlab` (#13) (@wroyca)
- added ixx module extension in source patterns (#11) (@wroyca)
- added support for multi-codepoint emojis
- improved `doxygen.exe` location discovery on Windows
- improved `CHANGELOG` location discovery
- moved all poxy assets in the generated HTML to `html/poxy`
- self-hosted google fonts in generated HTML (instead of requiring additional HTTP requests on page load) (#6)
- removed ability to override m.css implementation
- removed legacy support for reading config options from neighbouring Doxyfiles
- overhauled the light theme
- many minor style fixes and tweaks

## v0.7.1 - 2022-08-17
Expand Down
19 changes: 6 additions & 13 deletions poxy/css.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
Functions for working with CSS files.
"""

import re
import requests
from .utils import *
from . import dirs
from typing import Tuple

RX_COMMENT = re.compile(r'''/[*].+?[*]/''', flags=re.DOTALL)
RX_IMPORT = re.compile(r'''@import\s+url\(\s*['"]?\s*(.+?)\s*['"]?\s*\)\s*;''', flags=re.I)
Expand Down Expand Up @@ -72,12 +69,10 @@ def match_handler(m):
path = Path(dirs.GENERATED, rf'{sha1(import_path.lower())}.css')
if not path_ok() or (not use_cached_fonts and str(import_path).find(r'font') != -1):
print(rf"Downloading {import_path}")
headers = {
r'User-Agent': r'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0'
}
response = requests.get(import_path, headers=headers, timeout=10)
data = download_text(import_path)
print(rf"Writing {path}")
with open(path, 'w', encoding='utf-8', newline='\n') as f:
f.write(response.text)
f.write(data)

# otherwise just check cwd
if not path_ok():
Expand Down Expand Up @@ -110,12 +105,10 @@ def match_handler(m):
path = Path(dirs.FONTS, rf'{file_name}')
if not path.exists() or not use_cached_fonts:
print(rf"Downloading {uri}")
headers = {
r'User-Agent': r'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0'
}
response = requests.get(uri, headers=headers, timeout=10)
data = download_binary(uri)
print(rf"Writing {path}")
with open(path, 'wb') as f:
f.write(response.content)
f.write(data)

return rf"url('fonts/{file_name}')"

Expand Down
117 changes: 69 additions & 48 deletions poxy/data/css/m-theme-light.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
/* Base theme colors - this block does not appear in m.css */
.poxy-theme-light
{
--theme-hue: 215;
--theme-hue: 210;
--theme-saturation: 100%;
--theme-luminosity: 50%;
--theme-color: hsl(var(--theme-hue), var(--theme-saturation), var(--theme-luminosity));
--theme-text1: hsl(var(--theme-hue), var(--theme-saturation), 10%);
--theme-text2: hsl(var(--theme-hue), 30%, 30%);
--theme-surface1: hsl(var(--theme-hue), 25%, 90%);
--theme-surface2: hsl(var(--theme-hue), 20%, 99%);
--theme-surface3: hsl(var(--theme-hue), 10%, 80%);
--theme-surface4: hsl(var(--theme-hue), 10%, 95%);
--theme-surface3: hsl(var(--theme-hue), calc(var(--theme-saturation) * 0.3), 85%); /* footer color */
--theme-surface4: hsl(var(--theme-hue), 20%, 93%); /* background */
--theme-surface5: hsl(var(--theme-hue), calc(var(--theme-saturation) * 0.5), 60%); /* header bg color */
--theme-surface6: hsl(var(--theme-hue), calc(var(--theme-saturation) * 0.5), 68%); /* header active link bg color */
--theme-surface7: hsl(var(--theme-hue), var(--theme-saturation), 90%); /* header active link color */
}

.poxy-theme-light { /* NOTE: in vanilla m.css this is the :root element */
Expand Down Expand Up @@ -38,7 +41,7 @@
/* Basics */
--background-color: var(--theme-surface4);
--color: var(--theme-text1);
--line-color: #bdc3c7;
--line-color: var(--theme-surface6);
--link-color: var(--theme-color);
--link-active-color: var(--theme-text2);
--mark-color: #2f83cc;
Expand All @@ -48,7 +51,7 @@
/* Code */
--code-color: var(--theme-text1);
--code-background-color: var(--theme-surface2);
--code-note-background-color: rgba(250, 250, 250, 0.6);
--code-note-background-color: hsla(var(--theme-hue), var(--theme-saturation), 99%, 0.7);

/* Console */
--console-color: #fcfcfc;
Expand All @@ -58,13 +61,13 @@
--header-border-width: 0 0 0.25rem 0;
--header-color: var(--theme-surface1);
--header-breadcrumb-color: var(--theme-surface1);
--header-background-color: var(--theme-color);
--header-background-color: var(--theme-surface5);
--header-background-color-landing: rgba(34, 39, 46, 0.75);
--header-background-color-jumbo: rgba(34, 39, 46, 0.25);
--header-link-color: var(--theme-surface2);
--header-link-active-color: var(--theme-text1);
--header-link-current-color: var(--theme-surface1);
--header-link-active-background-color: var(--theme-surface3);
--header-link-active-color: var(--theme-surface7);
--header-link-current-color: var(--theme-surface7);
--header-link-active-background-color: var(--theme-surface6);
--header-link-active-background-color-semi: #ebeaea80;

/* Footer */
Expand Down Expand Up @@ -97,50 +100,68 @@

/* Colored components */
--default-color: var(--theme-text1);
--default-link-active-color: var(--theme-text2);
--default-link-active-color: var(--link-active-color);
--default-filled-color: #151414;
--default-filled-background-color: #d3d7d9;
--default-filled-background-color: var(--theme-surface3);
--default-filled-link-color: #134ECD;
--default-filled-link-active-color: #5787EF;

--primary-color: hsl(var(--theme-hue), var(--theme-saturation), calc(var(--theme-luminosity) * 1.4));
--primary-link-active-color: #dcdcdc;
--primary-filled-color: var(--theme-text1);
--primary-filled-background-color: hsl(var(--theme-hue), var(--theme-saturation), calc(var(--theme-luminosity) * 1.6));
--primary-filled-link-color: #2a75b6;
--primary-filled-link-active-color: var(--theme-text2);

--success-color: #31c25d;
--success-link-active-color: #dcf6e3;
--success-filled-color: #151414;
--success-filled-background-color: #4dd376;
--success-filled-link-color: #009929;
--success-filled-link-active-color: #dcf6e3;

--warning-color: #c7cf2f;
--warning-link-active-color: #f6f6dc;
--warning-filled-color: #151414;
--warning-filled-background-color: #d1d34d;
--warning-filled-link-color: #919900;
--warning-filled-link-active-color: #f6f6dc;

--danger-color: #f60000;
--danger-link-active-color: #f6dddc;
--danger-filled-color: #fafafa;
--danger-filled-background-color: #e23e3e;
--danger-filled-link-color: #f2c7c6;
--danger-filled-link-active-color: #f6dddc;

--info-color: #2e7dc5;
--info-link-active-color: #c6ddf2;
--info-filled-color: #fafafa;
--info-filled-background-color: #4c93d3;
--info-filled-link-color: #c6ddf2;
--info-filled-link-active-color: #dbeaf7;

--dim-color: #7c7c7c;
--primary-hue: var(--theme-hue);
--primary-saturation: var(--theme-saturation);
--primary-luminosity: calc(var(--theme-luminosity) * 1.05);
--primary-color: hsl(var(--primary-hue), var(--primary-saturation), var(--primary-luminosity));
--primary-link-active-color: hsl(var(--primary-hue), var(--primary-saturation), calc(var(--primary-luminosity) * 0.7));
--primary-filled-color: hsl(var(--primary-hue), var(--primary-saturation), 25%);
--primary-filled-background-color: hsl(var(--primary-hue), var(--primary-saturation), calc(var(--primary-luminosity) * 1.7));
--primary-filled-link-color: hsl(var(--primary-hue), var(--primary-saturation), 50%);
--primary-filled-link-active-color: var(--primary-filled-color);

--success-hue: 138;
--success-saturation: 50%;
--success-luminosity: 45%;
--success-color: hsl(var(--success-hue), var(--success-saturation), var(--success-luminosity));
--success-link-active-color: hsl(var(--success-hue), var(--success-saturation), calc(var(--success-luminosity) * 0.7));
--success-filled-color: hsl(var(--success-hue), var(--success-saturation), 25%);
--success-filled-background-color: hsl(var(--success-hue), calc(var(--success-saturation) * 0.9), calc(var(--success-luminosity) * 1.8));
--success-filled-link-color: hsl(var(--success-hue), calc(var(--success-saturation) * 0.8), 40%);
--success-filled-link-active-color: var(--success-filled-color);

--warning-hue: 55;
--warning-saturation: 50%;
--warning-luminosity: 45%;
--warning-color: hsl(var(--warning-hue), var(--warning-saturation), var(--warning-luminosity));
--warning-link-active-color: hsl(var(--warning-hue), var(--warning-saturation), calc(var(--warning-luminosity) * 0.7));
--warning-filled-color: hsl(var(--warning-hue), var(--warning-saturation), 20%);
--warning-filled-background-color: hsl(var(--warning-hue), calc(var(--warning-saturation) * 0.8), calc(var(--warning-luminosity) * 1.8));
--warning-filled-link-color: hsl(var(--warning-hue), calc(var(--warning-saturation) * 0.6), 40%);
--warning-filled-link-active-color: var(--warning-filled-color);

--danger-hue: 0;
--danger-saturation: 100%;
--danger-luminosity: 50%;
--danger-color: hsl(var(--danger-hue), var(--danger-saturation), var(--danger-luminosity));
--danger-link-active-color: hsl(var(--danger-hue), var(--danger-saturation), calc(var(--danger-luminosity) * 0.7));
--danger-filled-color: hsl(var(--danger-hue), var(--danger-saturation), 25%);
--danger-filled-background-color: hsl(var(--danger-hue), calc(var(--danger-saturation) * 0.8), calc(var(--danger-luminosity) * 1.75));
--danger-filled-link-color: hsl(var(--danger-hue), calc(var(--danger-saturation) * 0.6), 50%);
--danger-filled-link-active-color: var(--danger-filled-color);

--info-hue: 209;
--info-saturation: 62%;
--info-luminosity: 50%;
--info-color: hsl(var(--info-hue), var(--info-saturation), var(--info-luminosity));
--info-link-active-color: hsl(var(--info-hue), var(--info-saturation), calc(var(--info-luminosity) * 0.7));
--info-filled-color: hsl(var(--info-hue), var(--info-saturation), 25%);
--info-filled-background-color: hsl(var(--info-hue), calc(var(--info-saturation) * 0.8), calc(var(--info-luminosity) * 1.7));
--info-filled-link-color: hsl(var(--info-hue), calc(var(--info-saturation) * 0.6), 50%);
--info-filled-link-active-color: var(--info-filled-color);

--dim-hue: 0;
--dim-saturation: 0%;
--dim-luminosity: 48%;
--dim-color: hsl(var(--dim-hue), var(--dim-saturation), var(--dim-luminosity));
--dim-link-color: #292929;
--dim-link-active-color: #7c7c7c;
--dim-link-active-color: hsl(var(--dim-hue), var(--dim-saturation), calc(var(--dim-luminosity) * 0.7));
--dim-filled-color: #656565;
--dim-filled-background-color: #c5c4c4;
--dim-filled-link-color: #292929;
Expand Down
30 changes: 27 additions & 3 deletions poxy/data/css/poxy-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ h6:last-child
}

/* table of contents */
@media screen and (min-width: 1300px) and (min-height: 700px)
@media screen and (min-width: 1300px) and (min-height: 775px)
{
:root
{
Expand All @@ -270,7 +270,7 @@ h6:last-child
.poxy-toc
{
position: fixed;
top: 7rem;
top: 5rem;
left: calc(50% + 470px + var(--wide-page-left-offset));
min-width: 200px;
z-index: 5;
Expand Down Expand Up @@ -369,12 +369,14 @@ code.poxy-impl
article section:target > .m-code,
article section:target > .m-console,
article section:target > .m-note,
article section:target > .m-block,
article section:target > .m-container-inflate > .m-code,
article section:target > .m-container-inflate > .m-console,
article section:target > .m-container-inflate > .m-note,
article section:target > .m-container-inflate > .m-block,
article section:target section.m-doc-details > div > h3:first-child
{
border-color: var(--article-heading-color) !important;
border-color: var(--article-heading-color) !important;
}
article section:target section.m-doc-details > div > h3:first-child
{
Expand All @@ -388,6 +390,16 @@ article section:target section.m-doc-details > div > h3:first-child
color: var(--background-color) !important;
}

/* figures with captions */
figure.m-figure > figcaption
{
font-weight: initial !important;
font-size: 1rem !important;
text-align: center;
margin-top: initial;
}


/* links in transparent 'success' blocks */
.m-success:not(.m-note, .m-button) a
{
Expand Down Expand Up @@ -422,4 +434,16 @@ article section:target section.m-doc-details > div > h3:first-child
.m-danger:not(.m-note, .m-button) a:active
{
color: var(--danger-link-active-color);
}

/* links in transparent 'info' blocks */
.m-info:not(.m-note, .m-button) a
{
color: var(--info-color);
}
.m-info:not(.m-note, .m-button) a:hover,
.m-info:not(.m-note, .m-button) a:focus,
.m-info:not(.m-note, .m-button) a:active
{
color: var(--info-link-active-color);
}
15 changes: 9 additions & 6 deletions poxy/data/css/poxy-theme-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
--code-color-escapes: #b776fb;
--code-color-preprocessor: #808080;

--special-color: #b65ad7;
--special-link-active-color: #e4a8ff;
--special-filled-color: #fafafa;
--special-filled-background-color: #683b7d;
--special-filled-link-color: #C57CDF;
--special-filled-link-active-color: #F2D6FF;
--special-hue: 284;
--special-saturation: 50%;
--special-luminosity: 60%;
--special-color: hsl(var(--special-hue), var(--special-saturation), var(--special-luminosity));
--special-link-active-color: hsl(var(--special-hue), var(--special-saturation), calc(var(--special-luminosity) * 0.7));
--special-filled-color: hsl(var(--special-hue), var(--special-saturation), 25%);
--special-filled-background-color: hsl(var(--special-hue), calc(var(--special-saturation) * 0.8), calc(var(--special-luminosity) * 1.4));
--special-filled-link-color: hsl(var(--special-hue), calc(var(--special-saturation) * 0.6), 50%);
--special-filled-link-active-color: var(--special-filled-color);

--detail-section-header-color: var(--theme-surface3);
--detail-section-background-color: rgba(255, 255, 255, 0.3);
Expand Down
Loading

0 comments on commit 882d38f

Please sign in to comment.