...

Source file src/code.rocket9labs.com/tslocum/etk/style.go

Documentation: code.rocket9labs.com/tslocum/etk

     1  package etk
     2  
     3  import (
     4  	"image/color"
     5  	"log"
     6  
     7  	"github.com/hajimehoshi/ebiten/v2/examples/resources/fonts"
     8  	"golang.org/x/image/font/opentype"
     9  	"golang.org/x/image/font/sfnt"
    10  )
    11  
    12  var transparent = color.RGBA{0, 0, 0, 0}
    13  
    14  func defaultFont() *sfnt.Font {
    15  	f, err := opentype.Parse(fonts.MPlus1pRegular_ttf)
    16  	if err != nil {
    17  		log.Fatal(err)
    18  	}
    19  	return f
    20  }
    21  
    22  // Attributes represents a default attribute configuration. Integer values will be scaled.
    23  type Attributes struct {
    24  	TextFont *sfnt.Font
    25  	TextSize int
    26  
    27  	TextColorLight color.RGBA
    28  	TextColorDark  color.RGBA
    29  
    30  	TextBgColor color.RGBA
    31  
    32  	BorderSize int
    33  
    34  	BorderColorTop    color.RGBA
    35  	BorderColorRight  color.RGBA
    36  	BorderColorBottom color.RGBA
    37  	BorderColorLeft   color.RGBA
    38  
    39  	ScrollAreaColor   color.RGBA
    40  	ScrollHandleColor color.RGBA
    41  
    42  	ScrollBorderSize int
    43  
    44  	ScrollBorderColorTop    color.RGBA
    45  	ScrollBorderColorRight  color.RGBA
    46  	ScrollBorderColorBottom color.RGBA
    47  	ScrollBorderColorLeft   color.RGBA
    48  
    49  	InputBgColor color.RGBA
    50  
    51  	ButtonTextColor       color.RGBA
    52  	ButtonBgColor         color.RGBA
    53  	ButtonBgColorDisabled color.RGBA
    54  }
    55  
    56  // Style is the current default attribute configuration. Integer values will be scaled.
    57  var Style = &Attributes{
    58  	TextFont: defaultFont(),
    59  	TextSize: 32,
    60  
    61  	TextColorLight: color.RGBA{255, 255, 255, 255},
    62  	TextColorDark:  color.RGBA{0, 0, 0, 255},
    63  
    64  	TextBgColor: transparent,
    65  
    66  	BorderSize: 4,
    67  
    68  	BorderColorTop:    color.RGBA{220, 220, 220, 255},
    69  	BorderColorRight:  color.RGBA{0, 0, 0, 255},
    70  	BorderColorBottom: color.RGBA{0, 0, 0, 255},
    71  	BorderColorLeft:   color.RGBA{220, 220, 220, 255},
    72  
    73  	ScrollAreaColor:   color.RGBA{200, 200, 200, 255},
    74  	ScrollHandleColor: color.RGBA{108, 108, 108, 255},
    75  
    76  	ScrollBorderSize: 2,
    77  
    78  	ScrollBorderColorTop:    color.RGBA{240, 240, 240, 255},
    79  	ScrollBorderColorRight:  color.RGBA{0, 0, 0, 255},
    80  	ScrollBorderColorBottom: color.RGBA{0, 0, 0, 255},
    81  	ScrollBorderColorLeft:   color.RGBA{240, 240, 240, 255},
    82  
    83  	InputBgColor: color.RGBA{0, 128, 0, 255},
    84  
    85  	ButtonBgColor:         color.RGBA{255, 255, 255, 255},
    86  	ButtonBgColorDisabled: color.RGBA{110, 110, 110, 255},
    87  }
    88  

View as plain text