Skip to content

ColorPicker

R41z0r edited this page Jun 13, 2026 · 3 revisions

Contents

A ColorPicker stores one { r, g, b, a } color table.

ColorPicker example

Field Type Description
getColor function Reads current color as r, g, b, a.
setColor function Writes current color.
hasOpacity boolean Show alpha channel.
default table Default color.
app:RegisterControl("bars.colors", {
  id = "barColor",
  key = "barColor",
  type = "colorpicker",
  label = "Bar color",
  hasOpacity = true,
  default = { r = 0.9, g = 0.2, b = 0.2, a = 1 },
  getColor = function()
    local color = MyAddonDB.profile.barColor or { r = 0.9, g = 0.2, b = 0.2, a = 1 }
    return color.r, color.g, color.b, color.a
  end,
  setColor = function(_, r, g, b, a)
    MyAddonDB.profile.barColor = { r = r, g = g, b = b, a = a or 1 }
    MyAddon.ApplyBarColor()
  end,
})

Wiki
  • Home
  • Architecture
  • Vendoring
  • Quick Start
  • Field Glossary
  • Troubleshooting
  • Validation

Reference
  ⚬ Config API
  ⚬ UI API
  ⚬ Elements
  ⚬ Examples

Elements
  Structure
   • Category
   • Page
   • Group
   • Dashboard
   • InfoPage
   • Custom
  Controls
   • Toggle
   • CheckboxDropdown
   • Dropdown
   • MultiDropdown
   • SoundDropdown
   • Input
   • Slider
   • Button
  Advanced
   • ColorPicker
   • ColorPalette
   • ColorOverrides
   • ReorderList
   • Expandable
   • Notes

Examples
  Start
   • Minimal Addon
   • Complete Settings Center
   • Wrapper Bridge Pattern
  Data and Behavior
   • Dependent Controls
   • Nested Database Values
   • Dynamic Dropdowns
   • Runtime Refresh
   • Search and New Badges
   • Custom Hosted Editors
  Polish
   • Support Links
   • Theme Colors
   • Theme Borders

Clone this wiki locally