NanoXLSX.Core 3.0.0-rc.5
Loading...
Searching...
No Matches
ThemeColor.cs
1/*
2 * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way
3 * Copyright Raphael Stoeckli © 2026
4 * This library is licensed under the MIT License.
5 * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6 */
7
10using NanoXLSX.Themes;
11using NanoXLSX.Utils;
12
13namespace NanoXLSX.Colors
14{
18 public class ThemeColor : ITypedColor<Theme.ColorSchemeElement>
19 {
24
28 public string StringValue
29 {
30 get
31 {
32 return ParserUtils.ToString((int)ColorValue);
33 }
34 }
35
39 public ThemeColor()
40 {
41 }
42
48 {
49
50 ColorValue = color;
51 }
52
58 public ThemeColor(int index)
59 {
60 if (index < 0 || index > 11)
61 {
62 throw new StyleException("Indexed color value must be between 0 and 65.");
63 }
65 }
66
67
73 public override bool Equals(object obj)
74 {
75 return obj is ThemeColor color &&
76 ColorValue == color.ColorValue;
77 }
78
83 public override int GetHashCode()
84 {
85 return 800285905 + ColorValue.GetHashCode();
86 }
87 }
88}
ThemeColor()
Default constructor.
Definition ThemeColor.cs:39
ThemeColor(Theme.ColorSchemeElement color)
Constructor with color scheme element as parameter.
Definition ThemeColor.cs:47
ThemeColor(int index)
Constructor with index as parameter.
Definition ThemeColor.cs:58
override bool Equals(object obj)
Determines whether the specified object is equal to the current system color instance.
Definition ThemeColor.cs:73
override int GetHashCode()
Gets the hash code of the instance.
Definition ThemeColor.cs:83
Theme.ColorSchemeElement ColorValue
Gets or sets the color scheme element.
Definition ThemeColor.cs:23
string StringValue
Gets the internal, numeric OOXML string value of the enum, defined in ColorValue.
Definition ThemeColor.cs:29
Class for exceptions regarding Style incidents.
Class representing an Office theme.
Definition Theme.cs:17
ColorSchemeElement
Enum to define the sequence index of color scheme element, used in the implementations of Interfaces....
Definition Theme.cs:36
Class providing static methods to parse string values to specific types or to print object as languag...
static string ToString(int input)
Transforms an integer to an invariant sting.