Created by potrace 1.16, written by Peter Selinger 2001-2019 Spectre.Console
  • Sponsor Sponsor
  • GitHub icon GitHub
Welcome!
Sponsors
Quick Start
Best Practices
Recent Blog Posts
Release Notes
News
Markup
Exceptions
Live
Live Display
Progress
Status
Async Extensions
Prompts
Text prompt
Selection
Multi Selection
Widgets
Columns
Panel
Table
Tree
Bar Chart
Rows
Breakdown Chart
Rule
Calendar
Grid
Layout
Figlet
Padder
Canvas
Canvas Image
JSON
Text Path
Spectre.Console.Cli
Getting Started
Introduction
CommandApp
Specifying Settings
Creating Commands
Composing Commands
Migrate from Spectre.Cli
Exceptions
Command Help
Unit Testing
Appendix
Colors
Styles
Borders
Emojis
Spinners
API Reference

TryFromHex(string, Color) Method

  1. API Reference
  2. Spectre.Console
  3. Color
  4. TryFromHex(string, Color)
Tries to convert a hexadecimal color code to a Color object.
public static bool TryFromHex(string hex, out Color color)
Namespace
Spectre.Console
Containing Type
Color

Parameters

string hex
The hexadecimal color code.
Color color
When this method returns, contains the Color equivalent of the hexadecimal color code, if the conversion succeeded, or Default if the conversion failed.

Returns

bool
© 2025 Patrik Svensson, Phil Scott, Nils Andresen Powered by Netlify Supported by the .NET Foundation 1.0.0+d836ad18057fff49c119da310c6d86672fe38f48