Color API #83

Open
opened 2022-10-17 11:06:04 +02:00 by kazhnuz · 2 comments
Owner

Supporting more easily colors would be nice

Color.fromHex('#FFFFFF')
Color.fromOctets({r = 255, g = 255, b = 255, a = 1})
Color({r = 1, g = 1, b = 1, a = 1})
Colors.WHITE = Color({r = 1, g = 1, b = 1, a = 1})
Colors.BLACK = Color({r = 0, g = 0, b = 0, a = 1})
Colors.TRANSPARENT = Color({r = 1, g = 1, b = 1, a = 0})

  • utilities functions that use these table
function utils.graphics.setColor(color)
  local colors = colors or Colors.WHITE
  love.graphics.setColor(color.r, color.g, color.b, color.a or 1)
end
Supporting more easily colors would be nice ```lua Color.fromHex('#FFFFFF') Color.fromOctets({r = 255, g = 255, b = 255, a = 1}) Color({r = 1, g = 1, b = 1, a = 1}) ``` ```lua Colors.WHITE = Color({r = 1, g = 1, b = 1, a = 1}) Colors.BLACK = Color({r = 0, g = 0, b = 0, a = 1}) Colors.TRANSPARENT = Color({r = 1, g = 1, b = 1, a = 0}) ``` + utilities functions that use these table ```lua function utils.graphics.setColor(color) local colors = colors or Colors.WHITE love.graphics.setColor(color.r, color.g, color.b, color.a or 1) end ```
kazhnuz added this to the epervier 0.8.0 (beta 1) milestone 2022-10-17 11:06:04 +02:00
kazhnuz added the
1. Feature
2. Deliverable
4. Birb Core
labels 2022-10-17 11:06:04 +02:00
Author
Owner

Would need an hexToDecimal function

Would need an hexToDecimal function
Author
Owner

Will be needed for the Background, to make easier to have a ColoredBackground object

Will be needed for the Background, to make easier to have a ColoredBackground object
Sign in to join this conversation.
No description provided.