Skip to content

Commit

Permalink
Update MaterialColorName to use ToHex
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Jun 14, 2024
1 parent 94d5a19 commit c938559
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
30 changes: 0 additions & 30 deletions ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs

This file was deleted.

7 changes: 2 additions & 5 deletions ricaun.Revit.DB.Shape/MaterialUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ public static class MaterialUtils
/// <param name="green"></param>
/// <param name="blue"></param>
/// <param name="alpha"></param>
/// <returns>Color {alpha}{red}{blue}{green} in hexa</returns>
/// <returns>'Color RRGGBB' or 'Color AARRGGBB'</returns>
public static string MaterialColorName(byte red, byte green, byte blue, byte alpha = byte.MaxValue)
{
if (alpha == byte.MaxValue)
return string.Format("Color {0:X2}{1:X2}{2:X2}", red, green, blue);

return string.Format("Color {0:X2}{1:X2}{2:X2}{3:X2}", alpha, red, green, blue);
return string.Format("Color {0}", Extensions.ColorExtension.ToHex(red, green, blue, alpha).Trim('#'));
}

/// <summary>
Expand Down

0 comments on commit c938559

Please sign in to comment.