Skip to content

Commit 581533b

Browse files
committed
Improve Styling
1 parent 7b697c3 commit 581533b

9 files changed

Lines changed: 169 additions & 49 deletions

File tree

assets/css/bootstrap/scss/_variables.scss

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -735,15 +735,17 @@ $table-cell-padding-x-sm: .25rem !default;
735735

736736
$table-cell-vertical-align: top !default;
737737

738-
$table-color: var(--#{$prefix}emphasis-color) !default;
739-
$table-bg: var(--#{$prefix}body-bg) !default;
738+
$table-color: $theme-text-color-primary !default;
739+
// $table-bg: lighten($theme-code-bg-color, 15%) !default;
740+
$table-bg: $theme-code-bg-color !default;
740741
$table-accent-bg: transparent !default;
741742

742743
$table-th-font-weight: null !default;
743744

744745
$table-striped-color: $table-color !default;
745-
$table-striped-bg-factor: .05 !default;
746-
$table-striped-bg: rgba(var(--#{$prefix}emphasis-color-rgb), $table-striped-bg-factor) !default;
746+
$table-striped-bg-factor: 0 !default;
747+
// $table-striped-bg: darken($theme-code-bg-color, 100%) !default;
748+
$table-striped-bg: $theme-code-bg-color !default;
747749

748750
$table-active-color: $table-color !default;
749751
$table-active-bg-factor: .1 !default;
@@ -755,7 +757,7 @@ $table-hover-bg: rgba(var(--#{$prefix}emphasis-color-rgb), $table-h
755757

756758
$table-border-factor: .2 !default;
757759
$table-border-width: var(--#{$prefix}border-width) !default;
758-
$table-border-color: var(--#{$prefix}border-color) !default;
760+
$table-border-color: darken($theme-code-bg-color, 15%) !default;
759761

760762
$table-striped-order: odd !default;
761763
$table-striped-columns-order: even !default;
@@ -1546,8 +1548,8 @@ $modal-scale-transform: scale(1.02) !default;
15461548
// Define alert colors, border radius, and padding.
15471549

15481550
// scss-docs-start alert-variables
1549-
$alert-padding-y: $spacer !default;
1550-
$alert-padding-x: $spacer !default;
1551+
$alert-padding-y: $spacer * 0.5 !default;
1552+
$alert-padding-x: $spacer * 0.5 !default;
15511553
$alert-margin-bottom: 1rem !default;
15521554
$alert-border-radius: var(--#{$prefix}border-radius) !default;
15531555
$alert-link-font-weight: $font-weight-bold !default;

assets/css/theme/_docs.scss

Lines changed: 89 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
max-width: 600px;
33
}
44

5-
6-
75
.docs-overview {
86
.card {
97
border-color: $theme-divider;
@@ -332,57 +330,104 @@
332330
background: $smoky-white;
333331
margin-top: 1rem;
334332
margin-bottom: 1rem;
335-
336-
code {
337-
background: #fff;
338-
}
333+
334+
border-radius: 3px;
335+
border-top-right-radius: 9px;
336+
border-bottom-right-radius: 9px;
337+
338+
box-shadow: 5px 0px 15px rgba(0, 0, 0, 0.2);
339339

340340
.callout-title {
341-
font-size: 1rem;
341+
font-size: 1.15rem;
342+
343+
i {
344+
margin-right: 4px;
345+
}
346+
}
347+
348+
p:last-of-type, ul:last-of-type, ol:last-of-type, dl:last-of-type {
349+
margin-bottom: 0;
342350
}
343351

344352
&.callout-block-info {
345353
border-color: $theme-info-color;
346-
background: lighten($theme-info-color, 35%);
354+
background: rgba(lighten($theme-info-color, 35%), 0.95);
355+
color: darken($theme-info-color, 5%);
347356
.callout-title {
348-
color: darken($theme-info-color, 15%);
357+
color: darken($theme-info-color, 20%);
349358
}
350359
a {
351360
color: darken($theme-info-color, 15%);
352361
}
362+
strong {
363+
color: darken($theme-info-color, 10%);
364+
}
365+
code {
366+
background-color: rgba(darken($theme-info-color, 25%), 0.3);
367+
color: darken($theme-info-color, 25%);
368+
}
353369
}
354370
&.callout-block-success {
355371
border-color: $theme-success-color;
356-
background: lighten($theme-success-color, 40%);
372+
background: rgba(lighten($theme-success-color, 40%), 0.95);
373+
color: darken($theme-success-color, 10%);
357374
.callout-title {
358-
color: darken($theme-success-color, 15%);
375+
color: darken($theme-success-color, 25%);
359376
}
360377
a {
378+
color: darken($theme-success-color, 20%);
379+
}
380+
strong {
361381
color: darken($theme-success-color, 15%);
362382
}
383+
code {
384+
background-color: rgba(darken($theme-success-color, 25%), 0.3);
385+
color: darken($theme-success-color, 30%);
386+
}
363387
}
364388
&.callout-block-warning {
365389
border-color: $theme-warning-color;
366-
background: lighten($theme-warning-color, 35%);
390+
background: rgba(lighten($theme-warning-color, 37%), 0.95);
391+
color: darken($theme-warning-color, 5%);
367392
.callout-title {
368-
color: darken($theme-warning-color, 15%);
393+
color: darken($theme-warning-color, 20%);
369394
}
370395
a {
371396
color: darken($theme-warning-color, 15%);
372397
}
398+
strong {
399+
color: darken($theme-warning-color, 10%);
400+
}
401+
code {
402+
background-color: rgba(darken($theme-warning-color, 25%), 0.3);
403+
color: darken($theme-warning-color, 25%);
404+
}
373405
}
374406
&.callout-block-danger {
375407
border-color: $theme-danger-color;
376-
background: lighten($theme-danger-color, 35%);
408+
background: rgba(lighten($theme-danger-color, 36%), 0.95);
409+
color: darken($theme-danger-color, 5%);
377410
.callout-title {
378-
color: darken($theme-danger-color, 15%);
411+
color: darken($theme-danger-color, 20%);
379412
}
380413
a {
381414
color: darken($theme-danger-color, 15%);
382415
}
416+
strong {
417+
color: darken($theme-danger-color, 10%);
418+
}
419+
code {
420+
background-color: rgba(darken($theme-danger-color, 25%), 0.3);
421+
color: darken($theme-danger-color, 25%);
422+
}
383423
}
384424
}
385425

426+
.alert {
427+
font-size: 0.85rem;
428+
font-style: italic;
429+
}
430+
386431
.version-picker {
387432
position: fixed;
388433
top: 1rem;
@@ -415,6 +460,35 @@
415460
}
416461
}
417462

463+
figure {
464+
figcaption {
465+
font-style: italic;
466+
font-size: 0.85rem;
467+
color: rgba(darken($theme-bg, 10%), 0.9);
468+
font-family: monospace;
469+
}
470+
}
471+
472+
.table {
473+
margin-bottom: 0;
474+
475+
thead, tbody, tfoot, tr, td, th {
476+
border: none;
477+
}
478+
479+
480+
}
481+
.table-striped tbody tr:nth-of-type(odd) {
482+
background-color: rgba(lighten($theme-code-bg-color, 10%), 0.1);
483+
}
484+
485+
.table-responsive {
486+
border-radius: 4px;
487+
// border-width: 5px;
488+
// border-color: darken($theme-code-bg-color, 10%);
489+
}
490+
491+
418492

419493
/* printing */
420494
@media print {

docs/rish/3.0.0/best-practices.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ public partial class NestedElementsExample : RishElement
438438

439439
More complex Elements are defined in separate files.
440440

441-
_File 1_
441+
<figure>
442+
<figcaption>File 1</figcaption>
442443
{% highlight csharp %}
443444
public partial class NestedElementsExample : RishElement<NestedElementsExampleProps>
444445
{
@@ -455,8 +456,10 @@ public struct NestedElementsExampleProps {
455456
// ...
456457
}
457458
{% endhighlight %}
459+
</figure>
458460

459-
_File 2_
461+
<figure>
462+
<figcaption>File 2</figcaption>
460463
{% highlight csharp %}
461464
public partial class NestedElementsExample
462465
{
@@ -483,6 +486,7 @@ public partial class NestedElementsExample
483486
}
484487
}
485488
{% endhighlight %}
489+
</figure>
486490

487491
### Readability
488492
To maintain readability in declarative code, we enforce specific line-break rules.

docs/rish/3.0.0/installation.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Rish comes with a Roslyn Source Generator called **Rishenerator**. While it is t
2525
<div class="content">
2626
<h4 class="callout-title"><i class="fa-solid fa-circle-info"></i>Why use Rishenerator?</h4>
2727
<ul>
28-
<li><b>Drastically reduces development time</b> by automating boilerplate.</li>
29-
<li><b>Eliminates errors</b> associated with manual implementation.</li>
30-
<li><b>Optimizes performance</b> and memory efficiency automatically.</li>
28+
<li><strong>Drastically reduces development time</strong> by automating boilerplate.</li>
29+
<li><strong>Eliminates errors</strong> associated with manual implementation.</li>
30+
<li><strong>Optimizes performance</strong> and memory efficiency automatically.</li>
3131
</ul>
3232
</div>
3333
</div>
@@ -41,15 +41,16 @@ Rish comes with a Roslyn Source Generator called **Rishenerator**. While it is t
4141
- Ensure the **Select platforms for plugin** list is empty (no platforms selected).
4242
- Add (if not present already) the `RoslynAnalyzer` label.
4343

44-
_Note: The rest of this guide assumes Rishenerator is enabled._
44+
<div class="alert alert-warning" role="alert">
45+
The rest of this guide assumes Rishenerator is enabled.
46+
</div>
4547

4648
## Setup
4749
You can run multiple Rish apps simultaneously (e.g., one for Screen Space UI and another for World Space HUDs). Each app manages its own UI Toolkit tree.
4850

4951
To set up a Rish App in your scene:
5052
1. Create an empty **GameObject** (e.g., named "UI_Root").
51-
2. Add the `RishRoot` component to it.
52-
- _Note: This will automatically add a UIDocument component if one is missing._
53+
2. Add the `RishRoot` component to it. This will automatically add a `UIDocument` component if one is missing.
5354
3. Assign your **Panel Settings** to the `UIDocument`.
5455
4. Create a class that implements `IApp` and assign it to the `RishRoot`.
5556

docs/rish/3.0.0/memory-management.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ Rish automatically pools all reference types it handles.
2020
- **Allocation:** When a new instance is needed, Rish retrieves one from a pre-allocated pool.
2121
- **Deallocation:** When an instance is no longer needed (e.g., an element is unmounted), Rish automatically returns it to the pool.
2222

23-
_Crucial Rule: You should never call a constructor for a UI Element (or any type managed by Rish) directly. Always use the static `Create` methods. This ensures the element is correctly retrieved from the pool and tracked by Rish._
23+
<div class="callout-block callout-block-danger">
24+
<div class="content">
25+
<h4 class="callout-title">Crucial</h4>
26+
<p>You should <strong>never</strong> call a constructor for a UI Element (or any reference type managed by Rish) directly. Always use the static <code>Create</code> methods. This ensures the element is correctly retrieved from the pool and tracked by Rish.</p>
27+
</div>
28+
</div>
2429

2530
## The Pointer System
2631
To efficiently handle these pooled resources without exposing the heavy reference types to the user, Rish uses a **Pointer System**.
@@ -122,4 +127,6 @@ To create a custom pooled type:
122127

123128
Once implemented, Rish will automatically pool instances of your class and allow you to use them safely within Managed Contexts, just like native Rish types.
124129

125-
_A more in depth guide coming soon._
130+
<div class="alert alert-info" role="alert">
131+
A more in depth guide coming soon.
132+
</div>

docs/rish/3.0.0/quick-start.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
layout: docs
33
title: Quick Start
44
sections:
5-
- Creating and nesting elements
6-
- Elements Inputs
7-
- It's just C#
5+
- Why Rish?
6+
- Elements Composition
7+
- Inputs and Data Flow
8+
- It's Just C#
89
- Roots
910
order: 0
1011
icon: handshake
@@ -14,14 +15,14 @@ Welcome to **Rish**! Rish is a declarative UI library for Unity that uses **UI T
1415

1516
If you are familiar with React or other declarative UI frameworks, you will feel right at home. Rish (loosely) follows the React paradigm: you tell the computer what to do, not how to do it.
1617

17-
### Why Rish?
18+
## Why Rish?
1819
**Declarative:** You define the desired state of the UI, and Rish handles the updates.
1920

2021
**Best of Both Worlds:** It combines the benefits of Immediate Mode (code-driven, logical) with Retained Mode (stateful, efficient).
2122

2223
**Deterministic:** Implemented properly, your UI becomes a pure function of your game state. Always in sync and (hopefully 🤞) bug-free.
2324

24-
## Creating and nesting elements
25+
## Elements Composition
2526
Rish apps are built using Elements (a piece of the UI that has it's own logic and appearence). (Note: While React calls them "Components," we stick to "Elements" to align with UI Toolkit's naming conventions).
2627

2728
There are two distinct types of elements in Rish:

docs/rish/3.0.0/rishelements.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ All UI elements are added to a **Virtual Tree** managed by Rish.
2020
To create a new RishElement, you inherit from `RishElement` and implement the `Render` method. A `RishElement` always has exactly one child (the element returned by `Render`). If an element shouldn't have a child, you can return `Element.Null`.
2121

2222
### Types
23-
2423
There are three main base classes for `RishElement`, depending on your data needs:
24+
2525
- `RishElement`: For elements with no Props or State.
2626
- `RishElement<Props>`: For elements that receive data from parents.
2727
- `RishElement<Props, State>`: For elements that receive data and manage internal state.
2828

29-
_Note: Internally, every RishElement has a Props type. The base RishElement simply inherits from RishElement<NoProps>._
29+
<div class="callout-block callout-block-info">
30+
<div class="content">
31+
<h4 class="callout-title">Node</h4>
32+
<p>Internally, every RishElement has a Props type. The base <code>RishElement</code> simply inherits from <code>RishElement&lt;NoProps&gt;</code>.</p>
33+
</div>
34+
</div>
3035

3136
## Inputs: Props and State
3237
Our goal is a **Deterministic UI**. We treat UI elements as **Pure Functions**:
@@ -148,7 +153,12 @@ private partial class FooElement : RishElement, IManualState
148153
}
149154
{% endhighlight %}
150155

151-
_Warning: `IManualState.Restart` will be called right before the element gets reused from the Pool. Do not use `Restart` to unsubscribe from events or cancel actions. Use `ComponentWillUnmount` for that._
156+
<div class="callout-block callout-block-warning">
157+
<div class="content">
158+
<h4 class="callout-title">Warning</h4>
159+
<p><code>IManualState.Restart</code> will be called right before the element gets reused from the Pool. Do not use <code>Restart</code> to unsubscribe from events or cancel actions. Use <code>ComponentWillUnmount</code> for that.</p>
160+
</div>
161+
</div>
152162

153163
### Delayed Unmounting
154164
Sometimes you need to delay removal, for example, to play an Outro Animation.
@@ -259,7 +269,12 @@ Notifies you every time props are set, even if the values are identical (and the
259269
## UIToolkit Events
260270
RishElements can listen to UI Toolkit events (like clicks or hovers) just like VisualElements.
261271

262-
_**Important:** Since RishElements don't exist in the Visual Tree, Rish attaches these callbacks to the first VisualElement descendant._
272+
<div class="callout-block callout-block-info">
273+
<div class="content">
274+
<h4 class="callout-title">Important</h4>
275+
<p>Since RishElements don't exist in the Visual Tree, Rish attaches these callbacks to the first VisualElement descendant.</p>
276+
</div>
277+
</div>
263278

264279
{% highlight csharp %}
265280
public partial class FooElement : RishElement<NoProps, FooState>
@@ -281,7 +296,6 @@ public struct FooState {
281296
}
282297
{% endhighlight %}
283298

284-
285299
### REVIEW
286300
You can also create a `ToolkitManipulator` (similar to UI Toolkit's `Manipulator`) and add it to your RishElement with `AddManipulator` and remove it with `RemoveManipulator`.
287301

0 commit comments

Comments
 (0)