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

Color field #1748

Merged
merged 4 commits into from Mar 2, 2022
Merged

Color field #1748

merged 4 commits into from Mar 2, 2022

Conversation

ciukstar
Copy link
Contributor

@ciukstar ciukstar commented Feb 20, 2022

Reference issue #1747

This PR adds a new colorField function to create an html color field (<input type="color">) as described at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/color


Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

where
isHexColor :: String -> Bool
isHexColor ['#',a,b,c,d,e,f] = all isHexDigit [a,b,c,d,e,f]
isHexColor _ = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hex numbers in CSS can also be #fff (3 letters). Are you sure that all browsers ever only set 6 letter hex digits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/color:

"The value must be in seven-character hexadecimal notation, meaning the "#" character followed by two digits each representing red, green, and blue, like this: #rrggbb".

It is supposed to cover only HTML, not CSS.
Please let me know if I have to look in other non-HTML specs such as CSS. I'm not sure of this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess you're right! BTW, this would be the most official spec for HTML input: https://html.spec.whatwg.org/multipage/input.html#color-state-(type=color)
… the "bookkeeping details" are also interesting.

@jezen
Copy link
Member

jezen commented Feb 21, 2022

@ciukstar Thanks for the PR! Looks good to me 👍 I've started running the build on CI for this, and hopefully we can get this over the line for you soon.

@ciukstar
Copy link
Contributor Author

Hi! I see 14 successful and 4 failed checks. Do I need to do something to make it pass all the checks?

@jezen
Copy link
Member

jezen commented Mar 2, 2022

@ciukstar Sorry for the slow response, I've been busy escaping the war in Ukraine.

I'm not sure why those MacOS builds are failing. Perhaps @snoyberg might know?

@snoyberg
Copy link
Member

snoyberg commented Mar 2, 2022

I have no idea why it would have stopped working recently, I'm assuming that it's to do with GitHub Actions upgrading MacOS images. I see this error message:

yesod-bin                        > <command line>: can't load framework: Cocoa (not found)

I'd recommend ignoring the failure for now.

@jezen jezen merged commit 48d05fd into yesodweb:master Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants