vin-spiegel / ui-style

css style gui management module for nekoland lua scripting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lua-cascading

cascading based gui module for nekoland lua scripting inspired from css

to do

  • getter & setter
  • cascading value
  • receive and render from table value
  • extends & mix in

Concept

  • Seperate between logic and style

      local ui = require("ui")
    
      local myStyle = {
        width = Client.width/3,
        height = Client.height/3
      }
    
      local myPanel = ui.Panel{
        selector = myStyle
      }
    
    
      -- local myPanel = ui.Panel()
      -- myPanel.selector = myStyle
  • Generate style sheet just as table

    -- style.lua
    local myStyle = {}
    
    myStyle.content = {
        anchor = 4,
        height = 100,
        width = 300,
        pivotX = .5,
        pivotY = .5
        color = Color(200,200,200)
    }
    
    myStyle.modal = {
        width = Client.width,
        height = Client.height,
        color = Color(0, 0, 0, 100)
    }
    
    return myStyle
  • Apply selector from style.lua and rendering the value

    local style = require("style")
    local ui = require("ui")
    
    local modal = ui.Panel{
      selector = style.modal
    }
    
    local myContentPanel = ui.Panel{
      selector = style.content
      width = 500 -- apply cascading according to priority
      parent = modal
    }

License

MIT License

About

css style gui management module for nekoland lua scripting

License:MIT License


Languages

Language:Lua 100.0%