0

To have brighten color in highcharts, I must write only in this way? :

color: {
  linearGradient: [0,500,0,750],
  stops: [
    [0,Highcharts.Color('#E60028').brighten(0.1).get('rgb')],
    [1,Highcharts.Color('#5A000A').brighten(0.1).get('rgb')]  
    ]               
},

or is there another way?

For example:

color: {
  linearGradient: [0,500,0,750],
  stops: [
    [0,('#E60028').brighten(0.1).get('rgb')],
    [1,('#5A000A').brighten(0.1).get('rgb')]  
    ]               
},

I would like to know if is important to put Highcharts.Color

Thanks in advance

Seth McClaine
  • 9,142
  • 6
  • 38
  • 64
Mapsism Borja
  • 353
  • 2
  • 7
  • 15

2 Answers2

3

Highcharts.Color is a function which given the color code, gives you an object. That object contains the brighten function you are using. So yes it is important, unless you write your own function which does something like that.

It actually gives you the rgb(xx,yy,zz) version with the brightness involved. I don't know any other well known function or method which does this, so I recommend you keep using it.

Look at these questions and you'll see it's not an easy task changing the brightness:

  1. JavaScript Calculate brighter colour
  2. Increase CSS brightness color on click with jquery/javascript?
Community
  • 1
  • 1
Raein Hashemi
  • 3,346
  • 4
  • 22
  • 33
0

The Highcarts.Color() accepts rgb() and rgba() values but not plain HTML/CSS-Color codes. Put the parameter in quotes.

color: {
  linearGradient: [0,500,0,750],
  stops: [
    [0,Highcharts.Color('rgb(230, 0, 40)').brighten(0.1).get('rgb')],
    [1,Highcharts.Color('rgb( 90, 0, 10)').brighten(0.1).get('rgb')]  
    ]               
},
prokki
  • 111
  • 3
  • 12