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

Enable alpha channel in color selector #9224

Merged
merged 263 commits into from Dec 31, 2021

Conversation

adanielyan
Copy link
Contributor

This pull request adds alpha channel to Color interface in a form of 4th text box.

image

@benhaynes
Copy link
Sponsor Member

Two questions: is RGB (without alpha) still available separately? And, can you post a screenshot of this in the smallest half width field size? We need to make sure this fits instead of wrapping oddly.

Thanks!! ❤️

@adanielyan
Copy link
Contributor Author

Thank you for reviewing this PR.
The text boxes seem to fit nicely even on smallest screen.

image

When the alpha channel is FF (or 255) the color turns into RGB and the last 2 digits of hex code are removed (see the screenshot below). Therefore I believe having 2 separate variations in the dropdown (one for RGB and one for RGBA) would be redundant.

image

I changed the RGBA and HSLA labels to RGB(A) and HSL(A) respectively, to make this transformation less confusing.

Also bumped the max value for alpha channel to 255 to cover the entire spectrum (for some reason I initially decided to have percentage based range 0-100) in the last commit.

Please let me know if you have any other questions or concerns.

@benhaynes
Copy link
Sponsor Member

My understanding is that alpha is commonly set as 0 to 100 and stored as rgba(r, g, b, a), though I realize there is also this hex spec. I feel that we should avoid confusion for the 90% of people who just want RGB by adding this as an interface option: Include Alpha that toggles this feature. @rijkvanzanten ?

@adanielyan
Copy link
Contributor Author

OK, I see your point. How about this?

Screen.Recording.2021-10-29.at.12.36.54.mov

@jamescammarano
Copy link
Contributor

should the bar be labeled? I wouldn't know what that was right now.

@adanielyan
Copy link
Contributor Author

adanielyan commented Oct 29, 2021

should the bar be labeled? I wouldn't know what that was right now.

It could be, not sure where it will be the best to put the label though. On the other hand, it should not take a lot of effort to figure out what this slider does, even without a label.

EDIT: Also, adding a label will require providing translations too...

@adanielyan
Copy link
Contributor Author

Does this look better?

image

@jamescammarano
Copy link
Contributor

Does this look better?

image

I like that.

paulboudewijn and others added 18 commits October 29, 2021 14:22
* excluded VS specific files

* new files after updating directus sources

* case insensitive string matching fix

* Remove accidental commit files

* Cleanup gitignore

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
* Update source file en-US.yaml

* New translations en-US.yaml (Serbian (Latin))

* New translations en-US.yaml (Portuguese, Brazilian)

* New translations en-US.yaml (Indonesian)

* New translations en-US.yaml (Spanish, Chile)

* New translations en-US.yaml (Thai)

* New translations en-US.yaml (Hindi)

* New translations en-US.yaml (Chinese Traditional)

* New translations en-US.yaml (Spanish, Latin America)

* New translations en-US.yaml (Russian)

* New translations en-US.yaml (Polish)

* New translations en-US.yaml (Portuguese)

* New translations en-US.yaml (Swedish)

* New translations en-US.yaml (Turkish)

* New translations en-US.yaml (Estonian)

* New translations en-US.yaml (Vietnamese)

* New translations en-US.yaml (Chinese Simplified)

* New translations en-US.yaml (French)

* New translations en-US.yaml (Finnish)

* New translations en-US.yaml (Spanish)

* New translations en-US.yaml (Arabic)

* New translations en-US.yaml (Bulgarian)

* New translations en-US.yaml (Catalan)

* New translations en-US.yaml (Danish)

* New translations en-US.yaml (German)

* New translations en-US.yaml (Hungarian)

* New translations en-US.yaml (Italian)

* New translations en-US.yaml (Japanese)

* New translations en-US.yaml (Lithuanian)

* New translations en-US.yaml (Dutch)

* New translations en-US.yaml (Norwegian)

* New translations en-US.yaml (Slovenian)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
* WIP

* updates

* docs updates

* structure

* big structure update

* docs module icon change

* in-app docs nav

* more content and structure changes

* Remove redundant

* Fix docs build in app

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
* Update dependency stylelint to v14

* Update dependency stylelint-scss to v4

* Update dependency stylelint-order to v5

* Undo command change

* Update stylelint command

* Use modern color syntax

Who knew this was already supported everywhere? Awesome!!

* Update stylelint-config-standard

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
* Change v-checkbox background color when disabled

* Only apply style for block input.
…directus#8890)

* Reworked Sass to automatically generate color variations from palette

* Fixed naming scheme for mixing colors

* Updated light theme to use pre-defined steps

* Updated dark theme to use pre-defined steps, added steps at 90 & 110

* Hardcoded -alt color variations, extracted color variation generator to reusable mixin.

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
@adanielyan
Copy link
Contributor Author

The slider component is broken in Safari. The reason is that the appearance: none; is overridden by Safari's -webkit-appearance: slider-horizontal;. Adding -webkit-appearance: none; in slider's css fixes the problem. However on every commit it is converted to appearance: none; which doesn't do the trick. Any ideas how to fix that?

@benhaynes
Copy link
Sponsor Member

Not sure about the slider in Safari... I'll leave that to the engineers. But the last (small) request, is to decrease the space between the slider and the color chip options. Looking great, thank you for all this awesome work!

@rijkvanzanten
Copy link
Member

I think the small border radius is due to the fact that the slider track is made to be 4px high, at which size the border radius is 50%, however, with this thicker track that border radius no longer fits 🙂

The reason is that the appearance: none; is overridden by Safari's -webkit-appearance: slider-horizontal;. Adding -webkit-appearance: none; in slider's css fixes the problem. However on every commit it is converted to appearance: none; which doesn't do the trick. Any ideas how to fix that?

Good one.. I believe that's stylelint that's slightly too aggressive. Here's to hoping the Safari team hurries up with the unprefixed support; it's already support in Technology Preview after all! 😄

@adanielyan
Copy link
Contributor Author

Here you go, plus rounded edges

image

image

@adanielyan
Copy link
Contributor Author

I think the small border radius is due to the fact that the slider track is made to be 4px high, at which size the border radius is 50%, however, with this thicker track that border radius no longer fits 🙂

In fact the rounded corners were added by the browser (Edge). But I made them fully round anyway. I had to add that to v-slider component, but it will not affect the regular slider if --input-bg-image css var is not explicitly provided in the slider props.

Good one.. I believe that's stylelint that's slightly too aggressive. Here's to hoping the Safari team hurries up with the unprefixed support; it's already support in Technology Preview after all! 😄

If it's good for you it's good for me. I don't use Safari anyway! 😄

@adanielyan
Copy link
Contributor Author

Hey @benhaynes, is there anything else blocking this PR? If not, maybe it can be merged? Thanks!

@benhaynes
Copy link
Sponsor Member

Just the time it takes to have engineering formally review and merge. We've been abnormally busy on cloud the past few weeks... but should have more time starting next week. 👍

@adanielyan
Copy link
Contributor Author

Sure, understood. Just wanted to make sure there's nothing else to add/fix.

Copy link
Member

@rijkvanzanten rijkvanzanten left a comment

Choose a reason for hiding this comment

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

Couple of tiny nitpicks / tweaks. Otherwise great addition. Thanks @adanielyan! 😄

app/src/interfaces/select-color/select-color.vue Outdated Show resolved Hide resolved
app/src/interfaces/select-color/select-color.vue Outdated Show resolved Hide resolved
app/src/interfaces/select-color/select-color.vue Outdated Show resolved Hide resolved
app/src/interfaces/select-color/select-color.vue Outdated Show resolved Hide resolved
adanielyan and others added 3 commits December 3, 2021 14:14
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
@adanielyan
Copy link
Contributor Author

Thanks for suggestions! They have been implemented.

@adanielyan
Copy link
Contributor Author

Hi, is there any other action I need to take before this can be merged? Sorry, I am not very familiar with the process.

@benhaynes
Copy link
Sponsor Member

No, you're good. We've just been super busy with other releases and the holidays. We'll try to get this reviewed/merged ASAP.

@rijkvanzanten rijkvanzanten added this to the v9-next milestone Dec 28, 2021
@adanielyan
Copy link
Contributor Author

Great, thanks @benhaynes!

@rijkvanzanten rijkvanzanten merged commit 7ad5e76 into directus:main Dec 31, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet