--==================== 颜色工具 ==================== local function rgb(hex, a) local r = math.floor(hex / 0x10000) % 0x100 local g = math.floor(hex / 0x100) % 0x100 local b = hex % 0x100 -- 若你的 API 需要 0-255,就 return r, g, b, (a or 1)*255 return {r/255, g/255, b/255, a or 1} end local Colors = { white = rgb(0xFFFFFF), -- 面板背景:纯白 black = rgb(0x000000), -- 文字:纯黑 gray = rgb(0xE0E0E0), -- 分隔线 border = rgb(0xCCCCCC), -- 描边 } --==================== 面板定义 ==================== local panel = { x = 50, y = 150, w = 300, h = 200, bg = Colors.white, -- ★ 这里写死白色 title = "白色面板", radius = 12, -- 圆角半径(不需要可删) } --==================== 绘制 ==================== local function drawPanel(p) -- 1. 白色背景 setColor(p.bg) fillRect(p.x, p.y, p.w, p.h) -- 圆角就用 fillRoundRect(p.x,p.y,p.w,p.h,p.radius) -- 2. 灰色描边 setColor(Colors.border) strokeRect(p.x, p.y, p.w, p.h) -- 3. 标题栏分隔线 setColor(Colors.gray) drawLine(p.x, p.y + 32, p.x + p.w, p.y + 32) -- 4. 黑色标题文字(白底必须用深色字) setColor(Colors.black) drawText(p.title, p.x + 12, p.y + 8) end --==================== 主循环 ==================== local function onDraw() drawPanel(panel) end