gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/sgr/meta.go (about)

     1  package sgr
     2  
     3  type SGRMeta struct {
     4  	Flag Flag
     5  	Name string
     6  	Code string
     7  }
     8  
     9  var (
    10  	ResetMeta = SGRMeta{Flag: Reset, Name: ResetName, Code: ResetCode}
    11  
    12  	BoldMeta                 = SGRMeta{Flag: Bold, Name: BoldName, Code: BoldCode}
    13  	FaintMeta                = SGRMeta{Flag: Faint, Name: FaintName, Code: FaintCode}
    14  	ItalicMeta               = SGRMeta{Flag: Italic, Name: ItalicName, Code: ItalicCode}
    15  	FrakturMeta              = SGRMeta{Flag: Fraktur, Name: FrakturName, Code: FrakturCode}
    16  	ReversedMeta             = SGRMeta{Flag: Reversed, Name: ReversedName, Code: ReversedCode}
    17  	NormalIntensityMeta      = SGRMeta{Flag: NormalIntensity, Name: NormalIntensityName, Code: NormalIntensityCode}
    18  	NotItalicBlackLetterMeta = SGRMeta{Flag: NotItalicBlackLetter, Name: NotItalicBlackLetterName, Code: NotItalicBlackLetterCode}
    19  	NotReversedMeta          = SGRMeta{Flag: NotReversed, Name: NotReversedName, Code: NotReversedCode}
    20  
    21  	UnderlineMeta        = SGRMeta{Flag: Underline, Name: UnderlineName, Code: UnderlineCode}
    22  	DoublyUnderlinedMeta = SGRMeta{Flag: DoublyUnderlined, Name: DoublyUnderlinedName, Code: DoublyUnderlinedCode}
    23  	SlowBlinkMeta        = SGRMeta{Flag: SlowBlink, Name: SlowBlinkName, Code: SlowBlinkCode}
    24  	RapidBlinkMeta       = SGRMeta{Flag: RapidBlink, Name: RapidBlinkName, Code: RapidBlinkCode}
    25  	OverlinedMeta        = SGRMeta{Flag: Overlined, Name: OverlinedName, Code: OverlinedCode}
    26  	NotUnderlinedMeta    = SGRMeta{Flag: NotUnderlined, Name: NotUnderlinedName, Code: NotUnderlinedCode}
    27  	NotBlinkingMeta      = SGRMeta{Flag: NotBlinking, Name: NotBlinkingName, Code: NotBlinkingCode}
    28  	NotOverlinedMeta     = SGRMeta{Flag: NotOverlined, Name: NotOverlinedName, Code: NotOverlinedCode}
    29  
    30  	ConcealMeta                    = SGRMeta{Flag: Conceal, Name: ConcealName, Code: ConcealCode}
    31  	CrossedOutMeta                 = SGRMeta{Flag: CrossedOut, Name: CrossedOutName, Code: CrossedOutCode}
    32  	DisableProportionalSpacingMeta = SGRMeta{Flag: DisableProportionalSpacing, Name: DisableProportionalSpacingName, Code: DisableProportionalSpacingCode}
    33  	RevealMeta                     = SGRMeta{Flag: Reveal, Name: RevealName, Code: RevealCode}
    34  	NotCrossedOutMeta              = SGRMeta{Flag: NotCrossedOut, Name: NotCrossedOutName, Code: NotCrossedOutCode}
    35  	ProportionalSpacingMeta        = SGRMeta{Flag: ProportionalSpacing, Name: ProportionalSpacingName, Code: ProportionalSpacingCode}
    36  
    37  	FramedMeta                  = SGRMeta{Flag: Framed, Name: FramedName, Code: FramedCode}
    38  	EncircledMeta               = SGRMeta{Flag: Encircled, Name: EncircledName, Code: EncircledCode}
    39  	SuperscriptMeta             = SGRMeta{Flag: Superscript, Name: SuperscriptName, Code: SuperscriptCode}
    40  	SubscriptMeta               = SGRMeta{Flag: Subscript, Name: SubscriptName, Code: SubscriptCode}
    41  	NotFramedEncircledMeta      = SGRMeta{Flag: NotFramedEncircled, Name: NotFramedEncircledName, Code: NotFramedEncircledCode}
    42  	NotSuperscriptSubscriptMeta = SGRMeta{Flag: NotSuperscriptSubscript, Name: NotSuperscriptSubscriptName, Code: NotSuperscriptSubscriptCode}
    43  
    44  	IdeogramUnderlineMeta       = SGRMeta{Flag: IdeogramUnderline, Name: IdeogramUnderlineName, Code: IdeogramUnderlineCode}
    45  	IdeogramDoubleUnderlineMeta = SGRMeta{Flag: IdeogramDoubleUnderline, Name: IdeogramDoubleUnderlineName, Code: IdeogramDoubleUnderlineCode}
    46  	IdeogramOverlineMeta        = SGRMeta{Flag: IdeogramOverline, Name: IdeogramOverlineName, Code: IdeogramOverlineCode}
    47  	IdeogramDoubleOverlineMeta  = SGRMeta{Flag: IdeogramDoubleOverline, Name: IdeogramDoubleOverlineName, Code: IdeogramDoubleOverlineCode}
    48  	IdeogramStressMarkingMeta   = SGRMeta{Flag: IdeogramStressMarking, Name: IdeogramStressMarkingName, Code: IdeogramStressMarkingCode}
    49  	NoIdeogramAttributesMeta    = SGRMeta{Flag: NoIdeogramAttributes, Name: NoIdeogramAttributesName, Code: NoIdeogramAttributesCode}
    50  
    51  	FgBlackMeta   = SGRMeta{Flag: FgBlack, Name: FgBlackName, Code: FgBlackCode}
    52  	FgRedMeta     = SGRMeta{Flag: FgRed, Name: FgRedName, Code: FgRedCode}
    53  	FgGreenMeta   = SGRMeta{Flag: FgGreen, Name: FgGreenName, Code: FgGreenCode}
    54  	FgYellowMeta  = SGRMeta{Flag: FgYellow, Name: FgYellowName, Code: FgYellowCode}
    55  	FgBlueMeta    = SGRMeta{Flag: FgBlue, Name: FgBlueName, Code: FgBlueCode}
    56  	FgMagentaMeta = SGRMeta{Flag: FgMagenta, Name: FgMagentaName, Code: FgMagentaCode}
    57  	FgCyanMeta    = SGRMeta{Flag: FgCyan, Name: FgCyanName, Code: FgCyanCode}
    58  	FgWhiteMeta   = SGRMeta{Flag: FgWhite, Name: FgWhiteName, Code: FgWhiteCode}
    59  
    60  	BgBlackMeta   = SGRMeta{Flag: BgBlack, Name: BgBlackName, Code: BgBlackCode}
    61  	BgRedMeta     = SGRMeta{Flag: BgRed, Name: BgRedName, Code: BgRedCode}
    62  	BgGreenMeta   = SGRMeta{Flag: BgGreen, Name: BgGreenName, Code: BgGreenCode}
    63  	BgYellowMeta  = SGRMeta{Flag: BgYellow, Name: BgYellowName, Code: BgYellowCode}
    64  	BgBlueMeta    = SGRMeta{Flag: BgBlue, Name: BgBlueName, Code: BgBlueCode}
    65  	BgMagentaMeta = SGRMeta{Flag: BgMagenta, Name: BgMagentaName, Code: BgMagentaCode}
    66  	BgCyanMeta    = SGRMeta{Flag: BgCyan, Name: BgCyanName, Code: BgCyanCode}
    67  	BgWhiteMeta   = SGRMeta{Flag: BgWhite, Name: BgWhiteName, Code: BgWhiteCode}
    68  
    69  	FgBrightBlackMeta   = SGRMeta{Flag: FgBrightBlack, Name: FgBrightBlackName, Code: FgBrightBlackCode}
    70  	FgBrightRedMeta     = SGRMeta{Flag: FgBrightRed, Name: FgBrightRedName, Code: FgBrightRedCode}
    71  	FgBrightGreenMeta   = SGRMeta{Flag: FgBrightGreen, Name: FgBrightGreenName, Code: FgBrightGreenCode}
    72  	FgBrightYellowMeta  = SGRMeta{Flag: FgBrightYellow, Name: FgBrightYellowName, Code: FgBrightYellowCode}
    73  	FgBrightBlueMeta    = SGRMeta{Flag: FgBrightBlue, Name: FgBrightBlueName, Code: FgBrightBlueCode}
    74  	FgBrightMagentaMeta = SGRMeta{Flag: FgBrightMagenta, Name: FgBrightMagentaName, Code: FgBrightMagentaCode}
    75  	FgBrightCyanMeta    = SGRMeta{Flag: FgBrightCyan, Name: FgBrightCyanName, Code: FgBrightCyanCode}
    76  	FgBrightWhiteMeta   = SGRMeta{Flag: FgBrightWhite, Name: FgBrightWhiteName, Code: FgBrightWhiteCode}
    77  
    78  	BgBrightBlackMeta   = SGRMeta{Flag: BgBrightBlack, Name: BgBrightBlackName, Code: BgBrightBlackCode}
    79  	BgBrightRedMeta     = SGRMeta{Flag: BgBrightRed, Name: BgBrightRedName, Code: BgBrightRedCode}
    80  	BgBrightGreenMeta   = SGRMeta{Flag: BgBrightGreen, Name: BgBrightGreenName, Code: BgBrightGreenCode}
    81  	BgBrightYellowMeta  = SGRMeta{Flag: BgBrightYellow, Name: BgBrightYellowName, Code: BgBrightYellowCode}
    82  	BgBrightBlueMeta    = SGRMeta{Flag: BgBrightBlue, Name: BgBrightBlueName, Code: BgBrightBlueCode}
    83  	BgBrightMagentaMeta = SGRMeta{Flag: BgBrightMagenta, Name: BgBrightMagentaName, Code: BgBrightMagentaCode}
    84  	BgBrightCyanMeta    = SGRMeta{Flag: BgBrightCyan, Name: BgBrightCyanName, Code: BgBrightCyanCode}
    85  	BgBrightWhiteMeta   = SGRMeta{Flag: BgBrightWhite, Name: BgBrightWhiteName, Code: BgBrightWhiteCode}
    86  
    87  	CustomFgColorMeta         = SGRMeta{Flag: CustomFgColor, Name: CustomFgColorName, Code: CustomFgColorCode}
    88  	DefaultFgColorMeta        = SGRMeta{Flag: DefaultFgColor, Name: DefaultFgColorName, Code: DefaultFgColorCode}
    89  	CustomBgColorMeta         = SGRMeta{Flag: CustomBgColor, Name: CustomBgColorName, Code: CustomBgColorCode}
    90  	DefaultBgColorMeta        = SGRMeta{Flag: DefaultBgColor, Name: DefaultBgColorName, Code: DefaultBgColorCode}
    91  	CustomUnderlineColorMeta  = SGRMeta{Flag: CustomUnderlineColor, Name: CustomUnderlineColorName, Code: CustomUnderlineColorCode}
    92  	DefaultUnderlineColorMeta = SGRMeta{Flag: DefaultUnderlineColor, Name: DefaultUnderlineColorName, Code: DefaultUnderlineColorCode}
    93  
    94  	PrimaryFontMeta      = SGRMeta{Flag: PrimaryFont, Name: PrimaryFontName, Code: PrimaryFontCode}
    95  	AlternativeFont1Meta = SGRMeta{Flag: AlternativeFont1, Name: AlternativeFont1Name, Code: AlternativeFont1Code}
    96  	AlternativeFont2Meta = SGRMeta{Flag: AlternativeFont2, Name: AlternativeFont2Name, Code: AlternativeFont2Code}
    97  	AlternativeFont3Meta = SGRMeta{Flag: AlternativeFont3, Name: AlternativeFont3Name, Code: AlternativeFont3Code}
    98  	AlternativeFont4Meta = SGRMeta{Flag: AlternativeFont4, Name: AlternativeFont4Name, Code: AlternativeFont4Code}
    99  	AlternativeFont5Meta = SGRMeta{Flag: AlternativeFont5, Name: AlternativeFont5Name, Code: AlternativeFont5Code}
   100  	AlternativeFont6Meta = SGRMeta{Flag: AlternativeFont6, Name: AlternativeFont6Name, Code: AlternativeFont6Code}
   101  	AlternativeFont7Meta = SGRMeta{Flag: AlternativeFont7, Name: AlternativeFont7Name, Code: AlternativeFont7Code}
   102  
   103  	AlternativeFont8Meta = SGRMeta{Flag: AlternativeFont8, Name: AlternativeFont8Name, Code: AlternativeFont8Code}
   104  	AlternativeFont9Meta = SGRMeta{Flag: AlternativeFont9, Name: AlternativeFont9Name, Code: AlternativeFont9Code}
   105  )
   106  
   107  var flagMetaMap = map[Flag]*SGRMeta{
   108  	Reset: &ResetMeta,
   109  
   110  	Bold:                 &BoldMeta,
   111  	Faint:                &FaintMeta,
   112  	Italic:               &ItalicMeta,
   113  	Fraktur:              &FrakturMeta,
   114  	Reversed:             &ReversedMeta,
   115  	NormalIntensity:      &NormalIntensityMeta,
   116  	NotItalicBlackLetter: &NotItalicBlackLetterMeta,
   117  	NotReversed:          &NotReversedMeta,
   118  
   119  	Underline:        &UnderlineMeta,
   120  	DoublyUnderlined: &DoublyUnderlinedMeta,
   121  	SlowBlink:        &SlowBlinkMeta,
   122  	RapidBlink:       &RapidBlinkMeta,
   123  	Overlined:        &OverlinedMeta,
   124  	NotUnderlined:    &NotUnderlinedMeta,
   125  	NotBlinking:      &NotBlinkingMeta,
   126  	NotOverlined:     &NotOverlinedMeta,
   127  
   128  	Conceal:                    &ConcealMeta,
   129  	CrossedOut:                 &CrossedOutMeta,
   130  	DisableProportionalSpacing: &DisableProportionalSpacingMeta,
   131  	Reveal:                     &RevealMeta,
   132  	NotCrossedOut:              &NotCrossedOutMeta,
   133  	ProportionalSpacing:        &ProportionalSpacingMeta,
   134  
   135  	Framed:                  &FramedMeta,
   136  	Encircled:               &EncircledMeta,
   137  	Superscript:             &SuperscriptMeta,
   138  	Subscript:               &SubscriptMeta,
   139  	NotFramedEncircled:      &NotFramedEncircledMeta,
   140  	NotSuperscriptSubscript: &NotSuperscriptSubscriptMeta,
   141  
   142  	IdeogramUnderline:       &IdeogramUnderlineMeta,
   143  	IdeogramDoubleUnderline: &IdeogramDoubleUnderlineMeta,
   144  	IdeogramOverline:        &IdeogramOverlineMeta,
   145  	IdeogramDoubleOverline:  &IdeogramDoubleOverlineMeta,
   146  	IdeogramStressMarking:   &IdeogramStressMarkingMeta,
   147  	NoIdeogramAttributes:    &NoIdeogramAttributesMeta,
   148  
   149  	FgBlack:   &FgBlackMeta,
   150  	FgRed:     &FgRedMeta,
   151  	FgGreen:   &FgGreenMeta,
   152  	FgYellow:  &FgYellowMeta,
   153  	FgBlue:    &FgBlueMeta,
   154  	FgMagenta: &FgMagentaMeta,
   155  	FgCyan:    &FgCyanMeta,
   156  	FgWhite:   &FgWhiteMeta,
   157  
   158  	BgBlack:   &BgBlackMeta,
   159  	BgRed:     &BgRedMeta,
   160  	BgGreen:   &BgGreenMeta,
   161  	BgYellow:  &BgYellowMeta,
   162  	BgBlue:    &BgBlueMeta,
   163  	BgMagenta: &BgMagentaMeta,
   164  	BgCyan:    &BgCyanMeta,
   165  	BgWhite:   &BgWhiteMeta,
   166  
   167  	FgBrightBlack:   &FgBrightBlackMeta,
   168  	FgBrightRed:     &FgBrightRedMeta,
   169  	FgBrightGreen:   &FgBrightGreenMeta,
   170  	FgBrightYellow:  &FgBrightYellowMeta,
   171  	FgBrightBlue:    &FgBrightBlueMeta,
   172  	FgBrightMagenta: &FgBrightMagentaMeta,
   173  	FgBrightCyan:    &FgBrightCyanMeta,
   174  	FgBrightWhite:   &FgBrightWhiteMeta,
   175  
   176  	BgBrightBlack:   &BgBrightBlackMeta,
   177  	BgBrightRed:     &BgBrightRedMeta,
   178  	BgBrightGreen:   &BgBrightGreenMeta,
   179  	BgBrightYellow:  &BgBrightYellowMeta,
   180  	BgBrightBlue:    &BgBrightBlueMeta,
   181  	BgBrightMagenta: &BgBrightMagentaMeta,
   182  	BgBrightCyan:    &BgBrightCyanMeta,
   183  	BgBrightWhite:   &BgBrightWhiteMeta,
   184  
   185  	CustomFgColor:         &CustomFgColorMeta,
   186  	DefaultFgColor:        &DefaultFgColorMeta,
   187  	CustomBgColor:         &CustomBgColorMeta,
   188  	DefaultBgColor:        &DefaultBgColorMeta,
   189  	CustomUnderlineColor:  &CustomUnderlineColorMeta,
   190  	DefaultUnderlineColor: &DefaultUnderlineColorMeta,
   191  
   192  	PrimaryFont:      &PrimaryFontMeta,
   193  	AlternativeFont1: &AlternativeFont1Meta,
   194  	AlternativeFont2: &AlternativeFont2Meta,
   195  	AlternativeFont3: &AlternativeFont3Meta,
   196  	AlternativeFont4: &AlternativeFont4Meta,
   197  	AlternativeFont5: &AlternativeFont5Meta,
   198  	AlternativeFont6: &AlternativeFont6Meta,
   199  	AlternativeFont7: &AlternativeFont7Meta,
   200  
   201  	AlternativeFont8: &AlternativeFont8Meta,
   202  	AlternativeFont9: &AlternativeFont9Meta,
   203  }