Ejemplo n.º 1
0
func NewStandardTheme(ctx *nanovgo.Context) *Theme {
	ctx.CreateFontFromMemory("sans", MustAsset("fonts/Roboto-Regular.ttf"), 0)
	ctx.CreateFontFromMemory("sans-bold", MustAsset("fonts/Roboto-Bold.ttf"), 0)
	ctx.CreateFontFromMemory("icons", MustAsset("fonts/entypo.ttf"), 0)
	return &Theme{
		StandardFontSize:     16,
		ButtonFontSize:       20,
		TextBoxFontSize:      20,
		WindowCornerRadius:   2,
		WindowHeaderHeight:   30,
		WindowDropShadowSize: 10,
		ButtonCornerRadius:   2,

		DropShadow:        nanovgo.MONO(0, 128),
		Transparent:       nanovgo.MONO(0, 0),
		BorderDark:        nanovgo.MONO(29, 255),
		BorderLight:       nanovgo.MONO(92, 255),
		BorderMedium:      nanovgo.MONO(35, 255),
		TextColor:         nanovgo.MONO(255, 160),
		DisabledTextColor: nanovgo.MONO(255, 80),
		TextColorShadow:   nanovgo.MONO(0, 160),
		IconColor:         nanovgo.MONO(255, 160),

		ButtonGradientTopFocused:   nanovgo.MONO(64, 255),
		ButtonGradientBotFocused:   nanovgo.MONO(48, 255),
		ButtonGradientTopUnfocused: nanovgo.MONO(74, 255),
		ButtonGradientBotUnfocused: nanovgo.MONO(58, 255),
		ButtonGradientTopPushed:    nanovgo.MONO(41, 255),
		ButtonGradientBotPushed:    nanovgo.MONO(29, 255),

		WindowFillUnfocused:  nanovgo.MONO(43, 230),
		WindowFillFocused:    nanovgo.MONO(45, 230),
		WindowTitleUnfocused: nanovgo.MONO(220, 160),
		WindowTitleFocused:   nanovgo.MONO(255, 190),

		WindowHeaderGradientTop: nanovgo.MONO(74, 255),
		WindowHeaderGradientBot: nanovgo.MONO(58, 255),
		WindowHeaderSepTop:      nanovgo.MONO(92, 255),
		WindowHeaderSepBot:      nanovgo.MONO(29, 255),

		WindowPopup:            nanovgo.MONO(50, 255),
		WindowPopupTransparent: nanovgo.MONO(50, 0),

		FontNormal: "sans",
		FontBold:   "sans-bold",
		FontIcons:  "icons",
	}
}
Ejemplo n.º 2
0
func LoadDemo(ctx *nanovgo.Context) *demo.DemoData {
	d := &demo.DemoData{}
	for i := 0; i < 12; i++ {
		path := fmt.Sprintf("assets/image%d.jpg", i+1)
		d.Images = append(d.Images, ctx.CreateImageFromMemory(0, demo.MustAsset(path)))
		if d.Images[i] == 0 {
			log.Fatalf("Could not load %s", path)
		}
	}

	d.FontIcons = ctx.CreateFontFromMemory("icons", demo.MustAsset("assets/entypo.ttf"), 0)
	if d.FontIcons == -1 {
		log.Fatalln("Could not add font icons.")
	}
	d.FontNormal = ctx.CreateFontFromMemory("sans", demo.MustAsset("assets/Roboto-Regular.ttf"), 0)
	if d.FontNormal == -1 {
		log.Fatalln("Could not add font italic.")
	}
	d.FontBold = ctx.CreateFontFromMemory("sans-bold", demo.MustAsset("assets/Roboto-Bold.ttf"), 0)
	if d.FontBold == -1 {
		log.Fatalln("Could not add font bold.")
	}
	return d
}
Ejemplo n.º 3
0
func LoadFont(ctx *nanovgo.Context) {
	ctx.CreateFontFromMemory("materialicons", MustAsset("font/MaterialIcons-Regular.ttf"), 0)
}
Ejemplo n.º 4
0
func LoadFontAs(ctx *nanovgo.Context, name string) {
	ctx.CreateFontFromMemory(name, MustAsset("font/MaterialIcons-Regular.ttf"), 0)
}