“Everybody you ever met in your life was brought to you for a reason” | Found by John Beck McConnico (via @rudaycursi)
Every now and then I need to create a series of contrasting colors. For instance, in my mapping app PyTopo, when displaying several track logs at once, I want them to be different colors so it's easy to tell which track is which.
Of course, I could make a list of five or ten different colors and cycle through the list. But I hate doing work that a computer could do for me.
Choosing random RGB (red, green and blue) values for the colors, though, doesn't work so well. Sometimes you end up getting two similar colors together. Other times, you get colors that just don't work well, because they're so light they look white, or so dark they look black, or so unsaturated they look like shades of grey.
What does work well is converting to the HSV color space:
hue, saturation and value.
Hue is a measure of the color -- that it's red, or blue, or
yellow green, or orangeish, or a reddish purple.
Saturation measures how intense the color is: is it a bright, vivid
red or a washed-out red? Value tells you how light or dark it is: is
it so pale it's almost white, so dark it's almost black, or somewhere
in between? (A similar model, called HSL, substitutes Lightness for Value,
but is similar enough in concept.)
If you're not familiar with HSV, you can get a good feel for it by playing with GIMP's color chooser (which pops up when you click the black Foreground or white Background color swatch in GIMP's toolbox). The vertical rainbow bar selects Hue. Once you have a hue, dragging up or down in the square changes Saturation; dragging right or left changes Value. You can also change one at a time by dragging the H, S or V sliders at the upper right of the dialog.
Why does this matter? Because once you've chosen a saturation and value, or at least ensured that saturation is fairly high and value is somewhere in the middle of its range, you can cycle through hues and be assured that you'll get colors that are fairly different each time. If you had a red last time, this time it'll be a green, or yellow, or blue, depending on how much you change the hue.
How does this work programmatically?
PyTopo uses Python-GTK, so I need a function that takes a gtk.gdk.Color
and chooses a new, contrasting Color. Fortunately, gtk.gdk.Color already
has hue, saturation and value built in.
Color.hue is a floating-point number between 0 and 1,
so I just have to choose how much to jump. Like this:
def contrasting_color(color): '''Returns a gtk.gdk.Color of similar saturation and value to the color passed in, but a contrasting hue. gtk.gdk.Color objects have a hue between 0 and 1. ''' if not color: return self.first_track_color; # How much to jump in hue: jump = .37 return gtk.gdk.color_from_hsv(color.hue + jump, color.saturation, color.value)
What if you're not using Python-GTK?
me when people try to show me their baby pictures
DUNE NOISE, VHS / NEW ORLEANS / 2:29 AM
I wonder how feminists will react to this
Probably ignore it then go back to making male tears mugs and gifs
Actually this is a very common idea among feminists
It’s something feminists have been talking about for years it’s called toxic masculinity and it’s one of the common threads among the topic of ‘Patriarchy hurts men too’. If fact the first time I read about toxic masculinity was on a feminist blog.
If you actually read things feminists talk about instead of straw manning them you might know this but OH WELL
this girl was sent by the lord above to save humankind
its been estimated that 600 million or so has been poured into marketing minions so if we estimate the tuition at 40,000 dollars then about 150 students
i don’t know what’s more depressing,that 600 million dollars has been spent on advertizing minions or that 600 million dollars will only pay the tuition of 150 US college students
…… oh my god
You guys…. I’m not saying anything about Minions marketing here, but just math:
150 times $40,000 is $6 million. $600 million would be 15,000 students at $40,000 each.
Don’t skimp on the math classes, okay? That shit is important.
But which one is hotter
The answer explains many of my poor life choices
petition to rename the usa ‘south canada’
what about alaska
are we then normal canada
canada a bit to the left
What about South America? Is that just America? Or South South Canada?
i cried my ass of laughing
i caN’T BREATHE OH MY GOD
I’m not even from Canada but I approve this change of names
M ILKY E H
Milky Eh. I just died.
These dudes are fucking legit. They don’t just show up one day in court, either, they actually make friends with the kids and let them know they have a support system and that there are people in the world who care about them and will always have their back. And less important, but also cool, is that the few times a couple of them have come into my cafe, they’ve been super friendly and polite and when I told one of the guys that I noticed his Bikers Against Child Abuse patch and wanted him to know how awesome I thought he was because of it, he got kind of shy and blushed and said, “The kids are the awesome ones, we just let them know they’re allowed to be brave.”
The source is long, but so, so good. These men and women are available in 36 states, 24 hours a day to stand guard at home, in court, at school, even if the child has a nightmare. Many of them are survivors of childhood abuse as well, and know what it’s like to feel scared and alone.
In court that day, the judge asked the boy, “Are you afraid?” No, the boy said.
Pipes says the judge seemed surprised, and asked, “Why not?”
The boy glanced at Pipes and the other bikers sitting in the front row, two more standing on each side of the courtroom door, and told the judge, “Because my friends are scarier than he is.”
Actual tears.. hnngh
Show me more of people like this, world. I give up on humans too easily.
where do i sign up for this,i want to be in this gang
My friend told me about this a few years ago when I really needed this. They really are the nicest people in the world and I love them!!
This is fucking amazing. It may be out of character for me to say this but rock on
Bikers Against Child Abuse was founded in 1995 by a Native American child psychologist whose ride name is Chief, when he came across a young boy who had been subjected to extreme abuse and was too afraid to leave his house. He called the boy to reach out to him, but the only thing that seemed to interest the child was Chief’s bike. Soon, some 20 bikers went to the boy’s neighborhood and were able to draw him out of his house for the first time in weeks.
Chief’s thesis was that a child who has been abused by an adult can benefit psychologically from the presence of even more intimidating adults that they know are on their side. “When we tell a child they don’t have to be afraid, they believe us,” Arizona biker Pipes told azcentral.com. “When we tell them we will be there for them, they believe us.”
More about BACA, from their site
The fact that a native man started this brings tears to my eyes…
I’m crying omg.
IVE BEEN SAYING THIS THE WHOLE TIME!!!