usage: require("colors")
for the most part, this is a library containing color codes from paint tool
It also contains functions for working with color


colors.names = {"Gray", "Yellow", "LimeGreen", "Green", "Cyan", "Blue", "Violet", "Magenta", "Red", "Orange"}

number consts:

number consts (alias):

string consts:

smcolor consts:


methods:


fills the screen with a solid color from the paint tool

                local colors = require("colors")
local display = getComponent("display")

display.clear(colors.str.Red[2]) --fill the screen with red painttool
display.forceFlush()

function callback_loop()
    if _endtick then
        display.clear()
        display.forceFlush()
    end
end
            


makes the screen shimmer

                local colors = require("colors")
local display = getComponent("display")

function callback_loop()
    if _endtick then
        display.clear()
        display.forceFlush()
        return
    end

    display.clear(colors.pack(colors.hsvToRgb256(getUptime() % 256, 255, 255)))
    display.flush()
end
            


format color

                local colors = require("colors")

local function result(title, val)
    print(title, type(val), val)
end

result("formatToNumber(number)", colors.formatToNumber(0x663399))
result("formatToNumber(string)", colors.formatToNumber("663399"))
result("formatToNumber(color)", colors.formatToNumber(sm.color.new(0x663399ff)))
print("")

result("formatToColor(number)", colors.formatToColor(0x663399))
result("formatToColor(string)", colors.formatToColor("663399"))
result("formatToColor(color)", colors.formatToColor(sm.color.new(0x663399ff)))
print("")

result("formatToString(number)", colors.formatToString(0x663399))
result("formatToString(string)", colors.formatToString("663399"))
result("formatToString(color)", colors.formatToString(sm.color.new(0x663399ff)))

function callback_loop() end
            


the color gradient

                local colors = require("colors")
local display = getComponent("display")

local color1, color2 = 0xff0000, 0xff00ff
local width = display.getWidth()
local maxWidth = width - 1

for ix = 0, maxWidth do
    display.fillRect(ix, 0, 1, display.getHeight(), colors.combineColorToNumber(ix / maxWidth, color1, color2))
end
display.flush()

function callback_loop() end