LUA Reference Guide
2.10
2.10
  • EdgeTX 2.10 Lua Reference Guide
  • Introduction
    • Acknowledgments
    • Getting Started
  • Script Type Overview
    • Custom (Mixer) Scripts
    • Telemetry Scripts
    • One-Time Scripts
    • Function Scripts
    • Widget Scripts
  • EdgeTX Lua API Programming Guide
    • Lua Basics
    • Loading Code Modules Dynamically
    • Saving Memory
    • Using Key and Touch Events
    • Drawing Flags and Colors
    • Data Exchange with the EdgeTX Model Setup
    • Included Lua Libraries
      • io Library
        • io.open()
        • io.close()
        • io.read()
        • io.write()
        • io.seek()
  • EdgeTX Lua API Reference
    • Constants
      • Key Event Constants
      • Touch Event Constants
      • Flags and Pattern Constants
      • Color Constants
      • Special Character Constants
      • Screen Constants
      • Logical Switch Function Constants
      • Special Function Constants
      • Widget Options Constants
    • General Functions
      • GREY()
      • accessTelemetryPush()
      • chdir(directory)
      • crossfireTelemetryPop()
      • crossfireTelemetryPush()
      • defaultChannel(stick)
      • defaultStick(channel)
      • flushAudio()
      • getAvailableMemory()
      • getDateTime()
      • getFieldInfo(source)
      • getFlightMode(mode)
      • getGeneralSettings()
      • getGlobalTimer()
      • getLogicalSwitchValue(id)
      • getOutputValue(outputIndex)
      • getRAS()
      • getRSSI()
      • getRotEncMode()
      • getRotEncSpeed()
      • getRtcTime()
      • getShmVar(id)
      • getSourceIndex(sourceName)
      • getSourceName(sourceIndex)
      • getSourceValue(source)
      • getSwitchIndex(positionName)
      • getSwitchName(switchIndex)
      • getSwitchValue(switchIndex)
      • getTime()
      • getTxGPS()
      • getUsage()
      • getValue(source)
      • getVersion()
      • ghostTelemetryPop()
      • ghostTelemetryPush()
      • killEvents(key)
      • loadScript(file [, mode], [,env])
      • multiBuffer(address[,value])
      • playDuration(duration [, hourFormat [, volume]])
      • playFile(filename [, volume])
      • playHaptic(duration, pause [, flags])
      • playNumber(value, unit [, attributes [, volume]])
      • playTone(frequency, duration, pause [, flags [, freqIncr [, volume]]])
      • popupConfirmation(title, message, event)
      • popupInput(title, event, input, min, max)
      • popupWarning(title, event)
      • resetGlobalTimer([type])
      • serialGetPower(port_nr)
      • serialRead([num])
      • serialSetPower(port_nr, value)
      • serialWrite(str)
      • setSerialBaudrate(baudrate)
      • setShmVar(id, value)
      • setStickySwitch(id, value)
      • setTelemetryValue(id, subID, instance, value [, unit [, precision [, name]]])
      • sources([first[, last]])
      • switches([first[, last]])
      • sportTelemetryPop()
      • sportTelemetryPush()
    • Model Functions
      • model.defaultInputs()
      • model.deleteFlightModes()
      • model.deleteInput(input, line)
      • model.deleteInputs()
      • model.deleteMix(channel, line)
      • model.deleteMixes()
      • model.getCurve(curve)
      • model.getCustomFunction(function)
      • model.getFlightMode(index)
      • model.getGlobalVariable(index, flight_mode)
      • model.getInfo()
      • model.getInput(input, line)
      • model.getInputsCount(input)
      • model.getLogicalSwitch(switch)
      • model.getMix(channel, line)
      • model.getMixesCount(channel)
      • model.getModule(index)
      • model.getOutput(index)
      • model.getSensor(sensor)
      • model.getSwashRing()
      • model.getTimer(timer)
      • model.insertInput(input, line, value)
      • model.insertMix(channel, line, value)
      • model.resetSensor(sensor)
      • model.resetTimer(timer)
      • model.setCurve(curve, params)
      • model.setCustomFunction(function, value)
      • model.setFlightMode(index, params)
      • model.setGlobalVariable(index, flight_mode, value)
      • model.setInfo(value)
      • model.setLogicalSwitch(switch, value)
      • model.setModule(index, value)
      • model.setOutput(index, value)
      • model.setSwashRing(params)
      • model.setTimer(timer, value)
    • Lcd Functions
      • Lcd Functions Overview
      • lcd.RGB(r, g, b | rgb)
      • lcd.clear([color])
      • lcd.drawAnnulus(x, y, r1, r2, start, end [, flags])
      • lcd.drawArc(x, y, r, start, end [, flags])
      • lcd.drawBitmap(bitmap, x, y [, scale])
      • lcd.drawBitmapPattern(bitmap, x, y [, flags])
      • lcd.drawBitmapPatternPie(bitmap, x, y, startAngle, endAngle [, flags])
      • lcd.drawChannel(x, y, source, flags)
      • lcd.drawCircle(x, y, r [, flags])
      • lcd.drawCombobox(x, y, w, list, idx [, flags])
      • lcd.drawFilledCircle(x, y, r [, flags])
      • lcd.drawFilledRectangle(x, y, w, h [, flags])
      • lcd.drawFilledTriangle(x1, y1, x2, y2, x3, y3 [, flags])
      • lcd.drawGauge(x, y, w, h, fill, maxfill [, flags])
      • lcd.drawHudRectangle(pitch, roll, xmin, xmax, ymin, ymax [, flags])
      • lcd.drawLine(x1, y1, x2, y2, pattern, flags)
      • lcd.drawLineWithClipping(x1, y1, x2, y2, xmin, xmax, ymin, ymax, pattern [, flags])
      • lcd.drawNumber(x, y, value [, flags [, inversColor]])
      • lcd.drawPie(x, y, r, start, end [, flags])
      • lcd.drawPixmap(x, y, name)
      • lcd.drawPoint(x, y)
      • lcd.drawRectangle(x, y, w, h [, flags [, t]])
      • lcd.drawScreenTitle(title, page, pages)
      • lcd.drawSource(x, y, source [, flags])
      • lcd.drawSwitch(x, y, switch, flags)
      • lcd.drawText(x, y, text [, flags [, inversColor]])
      • lcd.drawTextLines(x, y, w, h, text [, flags])
      • lcd.drawTimer(x, y, value [, flags [, inversColor]])
      • lcd.drawTriangle(x1, y1, x2, y2, x3, y3 [, flags])
      • lcd.exitFullScreen()
      • lcd.getColor(flags)
      • lcd.getLastLeftPos()
      • lcd.getLastPos()
      • lcd.getLastRightPos()
      • lcd.invertRect(x, y, w, h [, flags])
      • lcd.refresh()
      • lcd.resetBacklightTimeout()
      • lcd.setColor(colorIndex, color)
      • lcd.sizeText(text [, flags])
    • Bitmap Functions
      • Bitmap.getSize(name)
      • Bitmap.open(name)
      • Bitmap.resize(bitmap, width, height)
      • Bitmap.toMask(bitmap)
    • Filesystem
      • dir(directory)
      • fstat(path)
      • del(file or directory)
  • Advanced Topics
    • Lua data sharing across scripts
    • Debugging techniques
    • Speed/memory optimizaton tricks
  • Appendix
    • Fonts
    • Units
Powered by GitBook
On this page
  • Indexed colors
  • Literal colors
  • Deprecated color constants

Was this helpful?

Export as PDF
  1. EdgeTX Lua API Reference
  2. Constants

Color Constants

On radios with color display, a color may be added to the flags described above.

There are two types of color constants: one that is an index into a table holding a palette of theme colors, and one that is just a color.

Indexed colors

These are the theme colors plus CUSTOM_COLOR, and they can be changed with the function lcd.setColor(color_index, color). Please note: if an indexed color is changed, then it changes everywhere that it is used. For the theme colors, this is not only in other widgets, but everywhere throughout the radio's user interface!

  • COLOR_THEME_PRIMARY1

  • COLOR_THEME_PRIMARY2

  • COLOR_THEME_PRIMARY3

  • COLOR_THEME_SECONDARY1

  • COLOR_THEME_SECONDARY2

  • COLOR_THEME_SECONDARY3

  • COLOR_THEME_FOCUS

  • COLOR_THEME_EDIT

  • COLOR_THEME_ACTIVE

  • COLOR_THEME_WARNING

  • COLOR_THEME_DISABLED

  • CUSTOM_COLOR

Literal colors

These color constants cannot be changed:

  • BLACK

  • WHITE

  • LIGHTWHITE

  • YELLOW

  • BLUE

  • DARKBLUE

  • GREY

  • DARKGREY

  • LIGHTGREY

  • RED

  • DARKRED

  • GREEN

  • DARKGREEN

  • LIGHTBROWN

  • DARKBROWN

  • BRIGHTGREEN

  • ORANGE

Deprecated color constants

These should no longer be used, but they are included for backwards compatibility. The old OpenTX API had a large number of indexed theme colors, and these have been mapped to the new theme colors as follows:

  • ALARM_COLOR -> COLOR_THEME_WARNING

  • BARGRAPH_BGCOLOR -> COLOR_THEME_SECONDARY3

  • BARGRAPH1_COLOR -> COLOR_THEME_SECONDARY1

  • BARGRAPH2_COLOR -> COLOR_THEME_SECONDARY2

  • CURVE_AXIS_COLOR -> COLOR_THEME_SECONDARY2

  • CURVE_COLOR -> COLOR_THEME_SECONDARY1

  • CURVE_CURSOR_COLOR -> COLOR_THEME_WARNING

  • HEADER_BGCOLOR -> COLOR_THEME_FOCUS

  • HEADER_COLOR -> COLOR_THEME_SECONDARY1

  • HEADER_CURRENT_BGCOLOR -> COLOR_THEME_FOCUS

  • HEADER_ICON_BGCOLOR -> COLOR_THEME_SECONDARY1

  • LINE_COLOR -> COLOR_THEME_PRIMARY3

  • MAINVIEW_GRAPHICS_COLOR -> COLOR_THEME_SECONDARY1

  • MAINVIEW_PANES_COLOR -> COLOR_THEME_PRIMARY2

  • MENU_TITLE_BGCOLOR -> COLOR_THEME_SECONDARY1

  • MENU_TITLE_COLOR -> COLOR_THEME_PRIMARY2

  • MENU_TITLE_DISABLE_COLOR -> COLOR_THEME_PRIMARY3

  • OVERLAY_COLOR -> COLOR_THEME_PRIMARY1

  • SCROLLBOX_COLOR -> COLOR_THEME_SECONDARY3

  • TEXT_BGCOLOR -> COLOR_THEME_SECONDARY3

  • TEXT_COLOR -> COLOR_THEME_SECONDARY1

  • TEXT_DISABLE_COLOR -> COLOR_THEME_DISABLED

  • TEXT_INVERTED_BGCOLOR -> COLOR_THEME_FOCUS

  • TEXT_INVERTED_COLOR -> COLOR_THEME_PRIMARY2

  • TITLE_BGCOLOR -> COLOR_THEME_SECONDARY1

  • TRIM_BGCOLOR -> COLOR_THEME_FOCUS

  • TRIM_SHADOW_COLOR -> COLOR_THEME_PRIMARY1

  • WARNING_COLOR -> COLOR_THEME_WARNING

PreviousFlags and Pattern ConstantsNextSpecial Character Constants

Last updated 1 year ago

Was this helpful?