Skip to content

🐞 Interpreted theme colors are inaccurate #1461

Closed

Description

@austincondiff

Description

Currently in our themes we define a hex value and it ends up being a much different shade than what was specified. This may have something to do with how the hex is interpreted.

Activity

  1. added
    bugSomething isn't working
    and removed
    enhancementNew feature or request
    needs refinementThis issue is not complete and has to be refined by the maintainers
    on Oct 27, 2023
  2. changed the title [-]✨ Use accurate colors in themes[/-] [+]🐞 Interpreted theme colors are inaccurate[/+] on Oct 27, 2023
  3. armartinez commented on Jan 15, 2024

    @armartinez
    Contributor

    @austincondiff I'm looking into this, do you have a concrete example where this problem is obvious ?

  4. austincondiff commented on Jan 15, 2024

    @austincondiff
    CollaboratorAuthor

    @armartinez Yes, if you open CodeEdit/DefaultThemes/codeedit-xcode-dark.json, you will see the Xcode Dark theme. It looks like the colors are off. So we went to the theme in Xcode and sampled each color, but even them it was off.

    image

    I sampled colors from the following sources and this is what I got...

    image

    It should match the default theme in Xcode exactly. I am suspicious that when I take a screenshot, the colors are muted and I get an inaccurate sample. Maybe it doesn't capture in P3 color, or it doesn't paste into Figma (where I do the color sample) into P3 color.

  5. armartinez commented on Jan 15, 2024

    @armartinez
    Contributor

    @austincondiff Yeah I've been trying the Digital Color Picker but there can be differences between what is selected and what the monitor is outputting depending on the color profile. I'll try to just match the color from what it's being displayed in Xcode and CodeEdit.

  6. armartinez commented on Jan 16, 2024

    @armartinez
    Contributor

    @austincondiff I found the issue. Xcode uses by default the color profile Generic RGB which is an old profile from the NSColorSpace (https://developer.apple.com/documentation/appkit/nscolorspace/1412082-genericrgbcolorspace?language=objc) while SwiftUI defaults to sRGB. For us to change that we would need to refactor the whole Color extension which doesn't seem worth it. I can convert the Xcode themes to srgb easily and use those value in the CodeEdit themes, this is a sample on how that looks (Left is CodeEdit) :

    Screenshot 2024-01-16 at 13 10 15
  7. austincondiff commented on Jan 16, 2024

    @austincondiff
    CollaboratorAuthor

    @armartinez could you clarify what you mean exactly by...

    1. For us to change that we would need to refactor the whole Color extension
      • what would be involved in doing something like this?
      • why would something like this be necessary?
    2. I can convert the Xcode themes to srgb easily?
      • Do you mean the json file in the DefaultThemes folder?
      • How would you convert the theme?
      • Would they still use hex values?
  8. armartinez commented on Jan 16, 2024

    @armartinez
    Contributor

    @austincondiff sure :

    1 - We are currently using the SwiftUI Color class to represent colors. This class accepts an enum RGBColorSpace which doesn't include the Generic RGB profile. In order to use that, we would have to replace the Color class with something like CGColor which accepts a CGColorSpace argument that includes GenericRGBLinear profile or find a way to extend the Color class to accept a new type of profile, which I don't know if it's even possible.

    2 - Yes I mean the json file, and I would just switch the current hex value (sRGB) for it's corresponding GenericRGB hex value.

  9. austincondiff commented on Jan 16, 2024

    @austincondiff
    CollaboratorAuthor

    Sounds good to me!

  10. armartinez commented on Jan 17, 2024

    @armartinez
    Contributor
  11. moved this from 🆕 New to 🏁 Complete in CodeEdit Projecton Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtheme

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions