Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/LumexUI.Docs/LumexUI.Docs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
<Target Name="InstallTailwindCSS" AfterTargets="Build" Condition="!Exists('tailwindcss.exe')">
<PropertyGroup>
<!-- Tailwind standalone CLI for Windows -->
<TailwindURL Condition="'$(OS)' == 'Windows_NT'">https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-windows-x64.exe</TailwindURL>
<TailwindURL Condition="'$(OS)' == 'Windows_NT'">https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.9/tailwindcss-windows-x64.exe</TailwindURL>
<TailwindFile Condition="'$(OS)' == 'Windows_NT'">tailwindcss-windows-x64.exe</TailwindFile>

<!-- Tailwind standalone CLI for Linux -->
<TailwindURL Condition="'$(OS)' != 'Windows_NT'">https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64</TailwindURL>
<TailwindURL Condition="'$(OS)' != 'Windows_NT'">https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.9/tailwindcss-linux-x64</TailwindURL>
<TailwindFile Condition="'$(OS)' != 'Windows_NT'">tailwindcss-linux-x64</TailwindFile>
</PropertyGroup>

Expand Down
27 changes: 27 additions & 0 deletions src/LumexUI/Extensions/DictionaryExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Diagnostics.CodeAnalysis;

namespace LumexUI.Extensions;

[ExcludeFromCodeCoverage]
internal static class DictionaryExtensions
{
public static Dictionary<TKey, TValue> TakeAllExceptLast<TKey, TValue>( this IReadOnlyDictionary<TKey, TValue> source, int count = 1 )
where TKey : notnull
{
ArgumentNullException.ThrowIfNull( source, nameof( source ) );

if( count < 1 )
{
throw new ArgumentOutOfRangeException( nameof( count ), count, "The count must be greater than one." );
}

if( count >= source.Count )
{
return [];
}

return source
.Take( source.Count - count )
.ToDictionary( x => x.Key, x => x.Value );
}
}
282 changes: 142 additions & 140 deletions src/LumexUI/Theme/Colors/SemanticColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// LumexUI licenses this file to you under the MIT license
// See the license here https://github.com/LumexUI/lumexui/blob/main/LICENSE

using LumexUI.Extensions;

using static LumexUI.Utilities.ColorUtils;

namespace LumexUI.Theme;
Expand All @@ -11,146 +13,146 @@ namespace LumexUI.Theme;
/// </summary>
public static class SemanticColors
{
private const string Default = "default";
private const string Foreground = "foreground";
private const string Default = "default";
private const string Foreground = "foreground";

/// <summary>
/// Represents the theme colors for the light theme.
/// </summary>
public readonly static ThemeColors Light = new()
{
Background = [
new( Default, Colors.White )
],
Foreground = [
.. Colors.Zinc,
new( Default, Colors.Zinc["700"] ),
],
Overlay = [
new( Default, Colors.Black )
],
Focus = [
new( Default, Colors.Blue["500"] )
],
Divider = [
new( Default, Colors.Zinc["900"] )
],
Surface1 = [
new( Default, Colors.White ),
new( Foreground, Colors.Zinc["900"] )
],
Surface2 = [
new( Default, Colors.Zinc["100"] ),
new( Foreground, Colors.Zinc["800"] )
],
Surface3 = [
new( Default, Colors.Zinc["200"] ),
new( Foreground, Colors.Zinc["700"] )
],
Default = [
.. Colors.Zinc,
new( Default, Colors.Zinc["300"] ),
new( Foreground, GetReadableColor( Colors.Zinc["300"] ) )
],
Primary = [
.. Colors.Blue,
new( Default, Colors.Blue["500"] ),
new( Foreground, GetReadableColor( Colors.Blue["500"] ) )
],
Secondary = [
.. Colors.Violet,
new( Default, Colors.Violet["500"] ),
new( Foreground, GetReadableColor( Colors.Violet["500"] ) )
],
Success = [
.. Colors.Green,
new( Default, Colors.Green["500"] ),
new( Foreground, GetReadableColor( Colors.Green["500"] ) )
],
Warning = [
.. Colors.Amber,
new( Default, Colors.Amber["500"] ),
new( Foreground, GetReadableColor( Colors.Amber["500"] ) )
],
Danger = [
.. Colors.Rose,
new( Default, Colors.Rose["500"] ),
new( Foreground, GetReadableColor( Colors.Rose["500"] ) )
],
Info = [
.. Colors.Sky,
new( Default, Colors.Sky["500"] ),
new( Foreground, GetReadableColor( Colors.Sky["500"] ) )
]
};
/// <summary>
/// Represents the theme colors for the light theme.
/// </summary>
public readonly static ThemeColors Light = new()
{
Background = [
new( Default, Colors.White )
],
Foreground = [
.. Colors.Zinc.TakeAllExceptLast(),
new( Default, Colors.Zinc["700"] ),
],
Overlay = [
new( Default, Colors.Black )
],
Focus = [
new( Default, Colors.Blue["500"] )
],
Divider = [
new( Default, Colors.Zinc["900"] )
],
Surface1 = [
new( Default, Colors.White ),
new( Foreground, Colors.Zinc["900"] )
],
Surface2 = [
new( Default, Colors.Zinc["100"] ),
new( Foreground, Colors.Zinc["800"] )
],
Surface3 = [
new( Default, Colors.Zinc["200"] ),
new( Foreground, Colors.Zinc["700"] )
],
Default = [
.. Colors.Zinc.TakeAllExceptLast(),
new( Default, Colors.Zinc["300"] ),
new( Foreground, GetReadableColor( Colors.Zinc["300"] ) )
],
Primary = [
.. Colors.Blue.TakeAllExceptLast(),
new( Default, Colors.Blue["500"] ),
new( Foreground, GetReadableColor( Colors.Blue["500"] ) )
],
Secondary = [
.. Colors.Violet.TakeAllExceptLast(),
new( Default, Colors.Violet["500"] ),
new( Foreground, GetReadableColor( Colors.Violet["500"] ) )
],
Success = [
.. Colors.Green.TakeAllExceptLast(),
new( Default, Colors.Green["500"] ),
new( Foreground, GetReadableColor( Colors.Green["500"] ) )
],
Warning = [
.. Colors.Amber.TakeAllExceptLast(),
new( Default, Colors.Amber["500"] ),
new( Foreground, GetReadableColor( Colors.Amber["500"] ) )
],
Danger = [
.. Colors.Rose.TakeAllExceptLast(),
new( Default, Colors.Rose["500"] ),
new( Foreground, GetReadableColor( Colors.Rose["500"] ) )
],
Info = [
.. Colors.Sky.TakeAllExceptLast(),
new( Default, Colors.Sky["500"] ),
new( Foreground, GetReadableColor( Colors.Sky["500"] ) )
]
};

/// <summary>
/// Represents the theme colors for the dark theme.
/// </summary>
public readonly static ThemeColors Dark = new()
{
Background = [
new( Default, Colors.Black )
],
Foreground = [
.. Colors.ReverseColorValues( Colors.Zinc ),
new( Default, Colors.Zinc["200"] ),
],
Overlay = [
new( Default, Colors.Black )
],
Focus = [
new( Default, Colors.Blue["500"] )
],
Divider = [
new( Default, Colors.Zinc["50"] )
],
Surface1 = [
new( Default, Colors.Zinc["900"] ),
new( Foreground, Colors.Zinc["50"] )
],
Surface2 = [
new( Default, Colors.Zinc["800"] ),
new( Foreground, Colors.Zinc["100"] )
],
Surface3 = [
new( Default, Colors.Zinc["700"] ),
new( Foreground, Colors.Zinc["200"] )
],
Default = [
.. Colors.ReverseColorValues( Colors.Zinc ),
new( Default, Colors.Zinc["300"] ),
new( Foreground, GetReadableColor( Colors.Zinc["300"] ) )
],
Primary = [
.. Colors.ReverseColorValues( Colors.Blue ),
new( Default, Colors.Blue["500"] ),
new( Foreground, GetReadableColor( Colors.Blue["500"] ) )
],
Secondary = [
.. Colors.ReverseColorValues( Colors.Violet ),
new( Default, Colors.Violet["500"] ),
new( Foreground, GetReadableColor( Colors.Violet["500"] ) )
],
Success = [
.. Colors.ReverseColorValues( Colors.Green ),
new( Default, Colors.Green["500"] ),
new( Foreground, GetReadableColor( Colors.Green["500"] ) )
],
Warning = [
.. Colors.ReverseColorValues( Colors.Amber ),
new( Default, Colors.Amber["500"] ),
new( Foreground, GetReadableColor( Colors.Amber["500"] ) )
],
Danger = [
.. Colors.ReverseColorValues( Colors.Rose ),
new( Default, Colors.Rose["500"] ),
new( Foreground, GetReadableColor( Colors.Rose["500"] ) )
],
Info = [
.. Colors.ReverseColorValues( Colors.Sky ),
new( Default, Colors.Sky["500"] ),
new( Foreground, GetReadableColor( Colors.Sky["500"] ) )
]
};
/// <summary>
/// Represents the theme colors for the dark theme.
/// </summary>
public readonly static ThemeColors Dark = new()
{
Background = [
new( Default, Colors.Black )
],
Foreground = [
.. Colors.ReverseColorValues( Colors.Zinc.TakeAllExceptLast() ),
new( Default, Colors.Zinc["200"] ),
],
Overlay = [
new( Default, Colors.Black )
],
Focus = [
new( Default, Colors.Blue["500"] )
],
Divider = [
new( Default, Colors.Zinc["50"] )
],
Surface1 = [
new( Default, Colors.Zinc["900"] ),
new( Foreground, Colors.Zinc["50"] )
],
Surface2 = [
new( Default, Colors.Zinc["800"] ),
new( Foreground, Colors.Zinc["100"] )
],
Surface3 = [
new( Default, Colors.Zinc["700"] ),
new( Foreground, Colors.Zinc["200"] )
],
Default = [
.. Colors.ReverseColorValues( Colors.Zinc.TakeAllExceptLast() ),
new( Default, Colors.Zinc["300"] ),
new( Foreground, GetReadableColor( Colors.Zinc["300"] ) )
],
Primary = [
.. Colors.ReverseColorValues( Colors.Blue.TakeAllExceptLast() ),
new( Default, Colors.Blue["500"] ),
new( Foreground, GetReadableColor( Colors.Blue["500"] ) )
],
Secondary = [
.. Colors.ReverseColorValues( Colors.Violet.TakeAllExceptLast() ),
new( Default, Colors.Violet["500"] ),
new( Foreground, GetReadableColor( Colors.Violet["500"] ) )
],
Success = [
.. Colors.ReverseColorValues( Colors.Green.TakeAllExceptLast() ),
new( Default, Colors.Green["500"] ),
new( Foreground, GetReadableColor( Colors.Green["500"] ) )
],
Warning = [
.. Colors.ReverseColorValues( Colors.Amber.TakeAllExceptLast() ),
new( Default, Colors.Amber["500"] ),
new( Foreground, GetReadableColor( Colors.Amber["500"] ) )
],
Danger = [
.. Colors.ReverseColorValues( Colors.Rose.TakeAllExceptLast() ),
new( Default, Colors.Rose["500"] ),
new( Foreground, GetReadableColor( Colors.Rose["500"] ) )
],
Info = [
.. Colors.ReverseColorValues( Colors.Sky.TakeAllExceptLast() ),
new( Default, Colors.Sky["500"] ),
new( Foreground, GetReadableColor( Colors.Sky["500"] ) )
]
};
}
Loading
Loading