Hi all,
TyControls 3.0 is out: 165 controls for Lazarus that draw themselves (with BGRABitmap) and take their whole look from a theme.
The same program can look like a classic desktop application, with bevels and gradient headers, or like a modern flat one in the style of today's web and Electron apps. One property switches the whole window, title bar included, between 17 built-in themes, each in light and dark, while the program runs. Nothing native is drawn, so it looks the same on Windows, Linux and macOS.
This is a visual library, so the pictures say more than I can:
Switching themes is one lineTyRegisterBuiltinThemes; // once at startup (unit tyControls.BuiltinThemes)
TyStyleController1.ThemeName := 'macos'; // or win11, classic, material3, fluent, ...
TyStyleController1.Mode := 'dark'; // or 'light'
Every control repaints in the new theme, no restart. Light/dark and the accent colour can also follow the OS. In the form designer you see the theme live as you set it.
Themes are text you can editA theme is a CSS-like .tycss file, so you can change one or write your own without recompiling:
TyButton { border-radius: var(--radius); padding: 6px 9px; }
TyButton:hover { background: var(--card-hover); }
TyButton.primary { background: var(--accent); color: var(--on-accent); }
A single control can be adjusted on its own too: set its StyleOverride to
border-radius: 14px; in the Object Inspector, and it still follows every theme change.
Also in the box- Everyday controls plus the heavy ones: a data grid with per-column editors, a multi-column virtual tree, a ribbon with key tips, charts, a calendar, shell file browsing and 20 custom-drawn dialogs
- HiDPI: vector drawing, crisp at any scaling, and it adapts when a window moves to a monitor with different scaling
- Designer support: palette, containers you drop controls straight into, File > New templates for a themed application or form
- 2,022 Lucide icons, referenced by name; the ones you don't use cost nothing
- English and Chinese UI strings (gettext .po)
- 6,000+ unit tests, and the whole suite runs leak-free
Getting itLazarus 3.0 or later, FPC 3.2.2 or later, BGRABitmap (BGRABitmapPack). Windows (win32/win64), Linux (gtk2, qt5, qt6; gtk3 partially) and macOS (cocoa).
- OPM: TyControls is in the Online Package Manager.
- By hand: download the zip from the release page, install BGRABitmapPack, then open tycontrols_dt.lpk and click Use > Install.
Then File > New... > Project > TyControls Application gives you a themed main form to start from. The
getting started guide takes it from there.
LinksLicense: modified LGPL, the same as the LCL, so you can use it in closed-source applications.
3.0 is the first stable release; the 2.x versions were previews. Thanks to everyone who tried them and reported problems. Bug reports and suggestions are welcome, here or on
GitHub.
ACTom