Coder Social home page Coder Social logo

utility-uss's Introduction

Utility USS

Tailwind CSS style utility classes for Unity stylesheets.

Differences from Tailwind CSS

  1. No half sizes (example: mt-0.5, px-3.5).
  2. Fractions in classes converted to words (example: h-1/3 => h-one-third)
  3. font-bold and font-italic combined into font-bold-italic

Usage

Copy dist/Utility.uss over to your Unity project and include it in your UXML document.

Example

<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
  <Style src="project://database/Assets/Utility.uss" />

  <ui:VisualElement class="w-full h-full bg-slate-300 items-center jusitfy-center">
    <ui:VisualElement class="w-48 p-12 text-center">
        <ui:Label text="Hello world!" class="text-slate-900 text-2xl">
    </ui:VisualElement>
  </ui:VisualElement>
</ui:UXML>

Development

First make sure you have nodejs installed on your system. Then run:

npm install

If you're actively developing run:

npm run dev

To create a production ready build run

npm run build

Not implemented

The following uss properties have not been implemented:

-unity-slice-bottom
-unity-slice-left
-unity-slice-right
-unity-slice-scale
-unity-slice-top

Notes

I'm in no way affiliated with Tailwind CSS. I just like Tailwind CSS on web projects and wanted something similar I could bring to Unity.

utility-uss's People

Contributors

robbyklein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

utility-uss's Issues

Small issue in ReadMe example code

This is a tiny thing, but in your ReadMe file, your example code doesn't close the Label, so UI Toolkit complains.

Thank you for making this. I look forward to using it!

โ€“ Jeremy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.