Skip to content

different themes along different instances not working #59

Description

@ironchestgames

Hiya guys! Thanks for this lib, I love it!

I have a problem with different instances with different themes, I can't get the solution in the docs to work. With some digging I think it is a bug in SUIT.

I think the problem is in the line below, it has a hard reference to the local theme table created on line 5.

https://github.com/vrld/SUIT/blob/ecce6820d7b72d324796850760e3b2d32e7e3fee/theme.lua#L18

Here is game code, that should work, but doesn't.

local suit = require('suit')

local dress -- called the instance the same as in the documentation

function love.load()
  dress = suit.new()

  -- this is copied from the documentation, I only changed the color values

  dress.theme = setmetatable({}, {__index = suit.theme})

  -- NOTE: you have to replace the whole color table. E.g., replacing only
  --       dress.theme.color.normal will also change suit.theme.color.normal!
  dress.theme.color = {
      normal   = {bg = {255, 0, 0}, fg = { 0, 255, 0}},
      hovered  = {bg = {255, 0, 255}, fg = {255, 255, 0}},
      active   = {bg = {0, 255, 255}, fg = {255, 255, 0}}
  }

end

function love.update(dt)
  dress:Button('text', 100, 100, 100, 100)
end

function love.draw()
  dress:draw()
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions