tw2x 1.0.2
dotnet tool install --global tw2x --version 1.0.2
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local tw2x --version 1.0.2
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=tw2x&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package tw2x --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
🌀 tailwind2xaml (tw2x)
Convert Tailwind CSS theme color definitions (OKLCH) into a XAML ResourceDictionary, ready for use in .NET MAUI, WPF, or UWP projects.
Why?
Design once, use everywhere! Reuse your Tailwind palette seamlessly in your XAML-based apps without manual hex conversions.
Features
- Converts Tailwind OKLCH colors to HEX
- Outputs clean, ready-to-use XAML
<Color>
resources - Supports black/white and fallback values
- Easy CLI usage
- Works cross-platform (Windows, macOS, Linux)
Installation
dotnet tool install -g tw2x
Usage
tw2x <inputFile> [outputFile]
Arguments
<inputFile>
— Required. Path to your Tailwind theme file (containing @theme { ... } block).[outputFile]
— Optional. Defaults to Colors.xaml next to your input file.
Optional target framework
tw2x theme.txt --target maui
tw2x theme.txt MyColors.xaml -t avalonia
Options for --target
:
maui
- .NET MAUI (default)wpf
- WPFavalonia
- Avalonia UIuwp
- UWPuno
- Uno Platform
Examples
tw2x tailwind.css
This will read tailwind.css
, extract the theme colors, convert them to HEX, and output a Colors.xaml
file in the same directory.
tw2x tailwind.css myColors.xaml
This will read tailwind.css
and output the converted colors to myColors.xaml
.
Example generated XAML
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="Red500">#EF4444</Color>
<Color x:Key="Blue500">#3B82F6</Color>
...
</ResourceDictionary>
Contributing
PRs and ideas welcome! Open an issue or submit a PR to suggest features or improvements.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.