Download Now

    Reference Codebot.Themes.Palettes.pas

    Part of the Codebot Themes Design package

    The Codebot.Themes.Palettes unit holds the themes of the IDE, with the colors and font of each one. It has no platform code, so the colors of a theme can be shown anywhere.

    A theme is a TThemeInfo, with a name, a palette of system colors, whether it is dark, the names of its fonts, and the size of its font. The theme named System Default uses the colors and visual styles of the system, and SystemColors holds the colors the dialog shows for it.

    Themes are loaded from JSON files using TJsonNode of Codebot.Text.Json. ThemesLoad fills ThemeList with System Default, the built in Dark theme, and the theme of every .json file in each folder you give it. A theme with the same name as one loaded before replaces it. System Default stays first in the list, and the others are sorted by name. ThemeLoadFile reads one file.

    A theme file looks like this, with colors written as #RRGGBB:

    {
      "name": "Aqua Dark",
      "dark": true,
      "font": { "name": ["Segoe UI", "Ubuntu Sans", "Noto Sans"], "size": 9, "linuxSize": 10 },
      "buttonRadius": 4,
      "colors": {
        "window": "#383838",
        "windowText": "#DADADA",
        "btnFace": "#2F2F2F",
        "highlight": "#1F9EDE"
      }
    }
    

    ColorNames holds the names of the colors, one for each COLOR_ constant: scrollBar, background, activeCaption, inactiveCaption, menu, window, windowFrame, menuText, windowText, captionText, activeBorder, inactiveBorder, appWorkspace, highlight, highlightText, btnFace, btnShadow, grayText, btnText, inactiveCaptionText, btnHighlight, 3dDkShadow, 3dLight, infoText, infoBk, hotLight, gradientActiveCaption, gradientInactiveCaption, menuHilight, menuBar, and form. Any color you leave out keeps the color of the system. You can give the radius of the corners of buttons in pixels as buttonRadius, and without it buttons keep the corners of the system. A file without a name is not loaded.

    The name of the font can be one name, or a list of names in the order you prefer them, so one theme can name a Windows font and the Linux fonts that look like it. ThemeFontName returns the first one that is installed. The font size linuxSize, which you can leave out, replaces size on Linux, where fonts of the same size look smaller. A theme with no font and a size of 0 uses the font of the system.

    FindTheme returns the index of a theme by name, or DefaultTheme, the index of the Dark theme, when there is no such theme. ThemeColor returns a system color of a theme.

    Items 20 items

    NameKindLine
    ColorNamesconstant53
    DarkColorsconstant63
    DefaultThemefunction149
    FindThemefunction152
    NoColorconstant50
    SystemColorsvariable103
    ThemeColorfunction154
    ThemeFontNamefunction157
    ThemeListvariable139
    ThemeLoadFilefunction143
    ThemesLoadprocedure147
    TPaletteColorsarray28
    TThemeInforecord38
    ButtonRadiusfield45
    Colorsfield42
    Customfield40
    Darkfield41
    FontNamesfield43
    FontSizefield44
    Namefield39