Page 1 of 1

ColourPaleete

Posted: Sun Jan 08, 2012 3:03 pm
by yarickyarick
http://colorschemedesigner.com/ - How is this implemented in Love?

Re: ColourPaleete

Posted: Sun Jan 08, 2012 3:20 pm
by tentus
It's not, it's written in Javascript, If you're asking how to port it over... that's a much harder question.

Re: ColourPaleete

Posted: Sun Jan 08, 2012 3:26 pm
by coffee
yarickyarick wrote:http://colorschemedesigner.com/ - How is this implemented in Love?
I'm not exactly sure what you mean by implemented but it's easy to copy/paste scheme colors in your projects. Choose you colors, click in export > text. You get something like this:

Code: Select all

var. 1 = #FFDE00 = rgb(255,222,0)
var. 2 = #BFAD30 = rgb(191,173,48)
var. 3 = #A69000 = rgb(166,144,0)
var. 4 = #FFE640 = rgb(255,230,64)
var. 5 = #FFED73 = rgb(255,237,115)
then just re-adapt

Code: Select all

color_v1 =  love.graphics.setColor(255,222,0)
color_v2 =  love.graphics.setColor(191,173,48)
color_v3 =  love.graphics.setColor(166,144,0)
color_v4 =  love.graphics.setColor(255,230,64)
color_v5 =  love.graphics.setColor(255,237,115)

Re: ColourPaleete

Posted: Sun Jan 08, 2012 4:10 pm
by yarickyarick
I'm doing a character editor and a player to make it easier to choose the right color, I decided to use a palette in the game, as it is carried at in Love?

Re: ColourPaleete

Posted: Sun Jan 08, 2012 5:05 pm
by MarekkPie
http://love2d.org/forums/viewtopic.php?f=4&t=6862

Check out that thread, yarick. There's a pretty easy way to do it if you just want to plop down an image for your palette.

Re: ColourPaleete

Posted: Mon Jan 09, 2012 12:24 am
by Jasoco
coffee wrote:

Code: Select all

color_v1 =  love.graphics.setColor(255,222,0)
color_v2 =  love.graphics.setColor(191,173,48)
color_v3 =  love.graphics.setColor(166,144,0)
color_v4 =  love.graphics.setColor(255,230,64)
color_v5 =  love.graphics.setColor(255,237,115)
Actually I prefer the easier to remember:

Code: Select all

color = {
  red = {255,0,0},
  yellow = {255,255,0}
  green = {0,255,0},
  blue = {0,0,25},
  white_trans = {255,255,255,175}
}

love.graphics.setColor(color.red)
And if you have to, you can retrieve its values with color.red[1] for its red value, [2] for green, [3] for blue and [4] for alpha if it's set.

Re: ColourPaleete

Posted: Mon Jan 09, 2012 9:32 am
by coffee
@Jasoco, I only give that basic answer because I thought yarickyarick didn't know how to apply the values given by colourscheme to LOVE.

I actually use in the same way a huge named database coupled to a custom function
http://love2d.org/forums/viewtopic.php? ... 854#p41738

Anyway now that I understand yarickyarick intentions and back to topic you could yarickyarick instead of using a color wheel do a more simple set of RGB sliders like this for choose the guy shirt color.
http://2000thingswpf.files.wordpress.co ... -start.png

Re: ColourPaleete

Posted: Mon Jan 09, 2012 11:45 am
by Robin
coffee wrote:

Code: Select all

color_v1 =  love.graphics.setColor(255,222,0)
color_v2 =  love.graphics.setColor(191,173,48)
color_v3 =  love.graphics.setColor(166,144,0)
color_v4 =  love.graphics.setColor(255,230,64)
color_v5 =  love.graphics.setColor(255,237,115)
By the way, that doesn't actually work. There are no color objects any more in LÖVE. Jasoco's example is the way to go.

Re: ColourPaleete

Posted: Mon Jan 09, 2012 5:34 pm
by MarekkPie
Robin wrote:
coffee wrote:

Code: Select all

color_v1 =  love.graphics.setColor(255,222,0)
color_v2 =  love.graphics.setColor(191,173,48)
color_v3 =  love.graphics.setColor(166,144,0)
color_v4 =  love.graphics.setColor(255,230,64)
color_v5 =  love.graphics.setColor(255,237,115)
By the way, that doesn't actually work. There are no color objects any more in LÖVE. Jasoco's example is the way to go.
The closest you could get to having something like that probably would be...

Code: Select all

function color_v1()
  love.graphics.setColor(255,222,0)
end
Which just obfuscates the code, in my opinion.

Re: ColourPaleete

Posted: Mon Jan 09, 2012 7:51 pm
by Jasoco
Well as long as you name the function something more recognizable like color_red() it'll be fine. You won't need to type or call love.graphics.setColor() yourself anymore unless you need a color not in your assortment of color functions.