Skip to content

Implement wide gamut color support in the Framework #127855

Closed

Description

@gaaclarke

After #55092 we have wide gamut support in the iOS engine, and after #127852 we'll have wide gamut support on Android.

Users have asked for ways to represent those colors inside of the framework so they can do things like:

Container(color: Color.displayP3(0.0, 0.0, 1.0, 1.0))

It's important that we don't change the meaning of old colors, that's why a normalized constructor for the Display P3 colorspace would be preferable.

I presume users would want to clip wide gamut colors to sRGB if their app is run on a device/platform without wide gamut support. It's unclear to me if that's acceptable to designers. If someone is making an iOS only app though they can pretty confidently known that wide gamut support will be supported.

This should have almost no effect on engine performance since the capability for wide gamut will already exist by virtue of having support for images.

We have to consider also the ramifications for Web and Desktop platforms. The absence of support for wide gamut colors in those platforms will become more apparent if the framework is updated to support them.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on May 30, 2023
  2. added
    c: new featureNothing broken; request for a new capability
    P3Issues that are less important to the Flutter project
    on May 30, 2023
  3. jtkeyva commented on May 31, 2023

    @jtkeyva

    awesome, thanks for clarifying this here. from a designers perspective, i don't know what good wide gamut images are without wide gamut UI or wide gamut video. i feel this is essential for a consistent ui/ux that has all the polish, shine and vibrant interface that consumers want and need.

    what about video? there is no mention of wide gamut color is/can be in video? do you need a separate issue for that?

    the user experience is what matters most to the users. this "dull / flat" color and the touch response latency issues (and 2 finger scroll speed lol) are essentially the only thing that doesn't feel native. if you patch those up, flutter is essentially indistinguishable from native.

    go team! go flutter! thanks for listening to the community and implementing what's important to us :)
    Cheers!

  4. Maistho commented on Jun 1, 2023

    @Maistho
    Contributor

    We have to consider also the ramifications for Web and Desktop platforms. The absence of support for wide gamut colors in those platforms will become more apparent if the framework is updated to support them.

    I don't know about Desktop, but Web supports wide gamut colors for both images and UI. Theres a good article on the chrome developer blog regarding this: https://developer.chrome.com/articles/high-definition-css-color-guide/

    Around 80% of people already use browsers that support wide gamut colors: https://caniuse.com/css-color-function

  5. jabedamin commented on Jun 2, 2023

    @jabedamin

    After #55092 we have wide gamut support in the iOS engine, and after #127852 we'll have wide gamut support on Android.

    Users have asked for ways to represent those colors inside of the framework so they can do things like:

    Container(color: Color.displayP3(0.0, 0.0, 1.0, 1.0))

    It's important that we don't change the meaning of old colors, that's why a normalized constructor for the Display P3 colorspace would be preferable.

    I presume users would want to clip wide gamut colors to sRGB if their app is run on a device/platform without wide gamut support. It's unclear to me if that's acceptable to designers. If someone is making an iOS only app though they can pretty confidently known that wide gamut support will be supported.

    This should have almost no effect on engine performance since the capability for wide gamut will already exist by virtue of having support for images.

    We have to consider also the ramifications for Web and Desktop platforms. The absence of support for wide gamut colors in those platforms will become more apparent if the framework is updated to support them.

    This is great, thank you! This step really is crucial to completing the support for wide gamut colours. Absolutely agree with the points made by @jtkeyva.

    I'm not sure how many variations to this there are but, when designing, I'd choose the Colour space to work with in the design software based on the target platform. Then input varying colour codes for different objects. If we had to specify the colour space for every object, wouldn't be scalable. If we could set the colour space at an app level however, then whatever RGB values we enter would get converted ideally based on what the device supports. So essentially, whatever colour space we set on the design project, we'd apply to the app. That way the output is consistent.

  6. jabedamin commented on Jun 16, 2023

    @jabedamin
  7. gaaclarke commented on Jun 16, 2023

    @gaaclarke
    Author
  8. jabedamin commented on Jun 17, 2023

    @jabedamin
  9. MaherSafadii commented on Jun 22, 2024

    @MaherSafadii

    this is a major issue in flutter which should be fixed asap imo.

  10. gaaclarke commented on Aug 1, 2024

    @gaaclarke
    MemberAuthor
  11. bernaferrari commented on Aug 6, 2024

    @bernaferrari
    Contributor

    My feedback:

    • Maybe it makes sense to provide a way to change the default color scheme of an app to be p3 only, without changing every single Color object. Maybe something like kColorSpace = .p3 and then it applies automatically unless otherwise written. CSS allows a fallback option for non-p3. Not sure if we want that, but it is interesting you can have both.
    • Android has a very nice Color API, maybe some inspiration could be taken from there (https://developer.android.com/reference/kotlin/android/graphics/Color). It supports rgb/srgb/xyz/lab,as well as many (many!) helper funtions. I think it is better than Flutter which has HSVColor, HSLColor, which feels second-citizen and has a lot less interoperability than Android. Flutter already has to deal with many of these functions in ColorScheme and dynamic theming from Material, so could make sense to bring some of them to Color so everybody could enjoy.
  12. knopp commented on Aug 6, 2024

    @knopp
    Member

    Can't add comments to the design doc. I'm wondering if 320bits for Color instance is bit of an overkill. Android Color packs everything into 64bits even for wide gamut (16 bits per channel, 10bit alpha, 6 bit colorspace). This might be problematic when compiling to javascript, but I'm not certain if supporting wide gamut for web/js is even feasible.

  13. 23 remaining items

  14. added a commit that references this issue on Sep 10, 2024
  15. gaaclarke commented on Sep 30, 2024

    @gaaclarke
    MemberAuthor

    There's no further planned work here. All the related PR's have landed, rolled and stuck.

  16. squirelboy360 commented on Sep 30, 2024

    @squirelboy360

    There's no further planned work here. All the related PR's have landed, rolled and stuck.

    I just saw this, how can we use this. Is it enabled by default?

  17. gaaclarke commented on Sep 30, 2024

    @gaaclarke
    MemberAuthor

    I just saw this, how can we use this. Is it enabled by default?

    It's available by default in the framework, see https://github.com/flutter/engine/blob/a49703b6383e54b48ebb710a92d81dffd0bd3d33/lib/ui/painting.dart#L118

    It will however only be rendered as a wide gamut / high bitrate color on iOS. There is the design doc above that you can check out too ( http://flutter.dev/go/wide-gamut-framework ).

  18. github-actions commented on Oct 14, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions