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
                    
if you are setting up this repo
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
                    
nuke :add-package tw2x --version 1.0.2
                    

🌀 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 - WPF
  • avalonia - Avalonia UI
  • uwp - UWP
  • uno - 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 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.

Version Downloads Last Updated
1.0.2 103 7/11/2025
1.0.1 101 7/11/2025
1.0.0 101 7/11/2025