// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. // Lexicon schema: site.standard.theme.basic package standardsite import ( "bytes" "encoding/json" "fmt" "io" lexutil "github.com/bluesky-social/indigo/lex/util" cbg "github.com/whyrusleeping/cbor-gen" ) func init() { lexutil.RegisterType("site.standard.theme.basic", &ThemeBasic{}) } type ThemeBasic struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.theme.basic"` // accent: Color used for links and button backgrounds. Accent *ThemeBasic_Accent `json:"accent" cborgen:"accent"` // accentForeground: Color used for button text. AccentForeground *ThemeBasic_AccentForeground `json:"accentForeground" cborgen:"accentForeground"` // background: Color used for content background. Background *ThemeBasic_Background `json:"background" cborgen:"background"` // foreground: Color used for content text. Foreground *ThemeBasic_Foreground `json:"foreground" cborgen:"foreground"` } // Color used for links and button backgrounds. type ThemeBasic_Accent struct { ThemeColor_Rgb *ThemeColor_Rgb } func (t *ThemeBasic_Accent) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *ThemeBasic_Accent) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil } } func (t *ThemeBasic_Accent) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *ThemeBasic_Accent) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } } // Color used for button text. type ThemeBasic_AccentForeground struct { ThemeColor_Rgb *ThemeColor_Rgb } func (t *ThemeBasic_AccentForeground) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *ThemeBasic_AccentForeground) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil } } func (t *ThemeBasic_AccentForeground) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *ThemeBasic_AccentForeground) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } } // Color used for content background. type ThemeBasic_Background struct { ThemeColor_Rgb *ThemeColor_Rgb } func (t *ThemeBasic_Background) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *ThemeBasic_Background) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil } } func (t *ThemeBasic_Background) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *ThemeBasic_Background) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } } // Color used for content text. type ThemeBasic_Foreground struct { ThemeColor_Rgb *ThemeColor_Rgb } func (t *ThemeBasic_Foreground) MarshalJSON() ([]byte, error) { if t.ThemeColor_Rgb != nil { t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" return json.Marshal(t.ThemeColor_Rgb) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *ThemeBasic_Foreground) UnmarshalJSON(b []byte) error { typ, err := lexutil.TypeExtract(b) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return json.Unmarshal(b, t.ThemeColor_Rgb) default: return nil } } func (t *ThemeBasic_Foreground) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } if t.ThemeColor_Rgb != nil { return t.ThemeColor_Rgb.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *ThemeBasic_Foreground) UnmarshalCBOR(r io.Reader) error { typ, b, err := lexutil.CborTypeExtractReader(r) if err != nil { return err } switch typ { case "site.standard.theme.color#rgb": t.ThemeColor_Rgb = new(ThemeColor_Rgb) return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } }