Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Color managment

Color managment

Scheduled Pinned Locked Moved Graphics
helpalgorithmsworkspace
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stevo Z
    wrote on last edited by
    #1

    Hi, I'm creating a button, that has specified BG color. Color of it's text is calculated using simple algorithm from this BG color. For this purpose, I use HSL color scheme. algorithm of text color calculation is very simple : Hue - same as background Saturation - 0 Luminance - if background luminance exceeds 0.5f , set 0F, else 1f otherwords - use white color if the bacground color is kind of dark, otherwise use black color. And now my problem : lets say we have a color like : Hue = whatever Saturation = 1f Luminance = .5f (that should be clearest mixture for any hue) the problem is that some color values are very bright in this configuration and some are very dark: pure blue (0.66 hue) - too dark cyan (0.5f hue) - too bright so sometimes the difference(for human eye) between specified background color and calculated text color is almost none (even when luminance difference is at least .5f) can you help me out with any better way to calculate text color (I would like to keep it in gray scale) thanx :) I hope you'll understand my English :)))

    I 1 Reply Last reply
    0
    • S Stevo Z

      Hi, I'm creating a button, that has specified BG color. Color of it's text is calculated using simple algorithm from this BG color. For this purpose, I use HSL color scheme. algorithm of text color calculation is very simple : Hue - same as background Saturation - 0 Luminance - if background luminance exceeds 0.5f , set 0F, else 1f otherwords - use white color if the bacground color is kind of dark, otherwise use black color. And now my problem : lets say we have a color like : Hue = whatever Saturation = 1f Luminance = .5f (that should be clearest mixture for any hue) the problem is that some color values are very bright in this configuration and some are very dark: pure blue (0.66 hue) - too dark cyan (0.5f hue) - too bright so sometimes the difference(for human eye) between specified background color and calculated text color is almost none (even when luminance difference is at least .5f) can you help me out with any better way to calculate text color (I would like to keep it in gray scale) thanx :) I hope you'll understand my English :)))

      I Offline
      I Offline
      IdUnknown
      wrote on last edited by
      #2

      You should read this article. IdealTextColor[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups