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

add hex formatting options to frontmatter #8

Closed
backwardspy opened this issue Apr 1, 2024 · 4 comments
Closed

add hex formatting options to frontmatter #8

backwardspy opened this issue Apr 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@backwardspy
Copy link
Member

backwardspy commented Apr 1, 2024

it'd be nice to be able to configure how whiskers represents colour as hexadecimal.

for example, this template:

---
whiskers:
  hex:
    capitalize: true
    prefix: "#"
---
{red.hex}

would produce #D20F39 instead of the default d20f39.

capitalize + prefix as options gives us a good amount of flexibility out of the box for common formats like #RRGGBB and 0xRRGGBB, but it's worth considering a more complex implementation that could allow more control, for example being able to specify a format string like 0x{a:02X}{b:02X}{g:02X}{r:02X} to produce 0xAABBGGRR format colours.

@backwardspy backwardspy added the enhancement New feature or request label Apr 1, 2024
@rubyowo
Copy link
Member

rubyowo commented Apr 1, 2024

i assume you mean 0x{a:02X}{b:02X}{g:02X}{r:02X}

@backwardspy
Copy link
Member Author

i assume you mean 0x{a:02X}{b:02X}{g:02X}{r:02X}

ah yep, good catch! edited.

@backwardspy
Copy link
Member Author

@rubyowo has rightly pointed out that we already have some of this implemented, but it's undocumented. i would advise not relying on the frontmatter options in their current form as we might change then, but if they solve a big problem right now then they are technically usable.

@backwardspy
Copy link
Member Author

completed in #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants