use mod.prelude.widgets_internal.*
mod.widgets.Button.padding = mod.turtle.Inset{left: 8.0 right: 8.0 top: 4.0 bottom: 4.0}
mod.widgets.Button.draw_bg.border_radius = 0.0
mod.widgets.Button.draw_bg.border_size = 2.0
mod.widgets.Button.draw_bg.color_2 = #d4d0c8
mod.widgets.TextInput.draw_bg.border_radius = 0.0
mod.widgets.Window.pass.clear_color = #d4d0c8
// Raised gray command buttons, with a depressed face while held.
mod.widgets.Button.draw_bg.pixel = fn() {
let p=self.pos*self.rect_size
let size=self.rect_size
let sunken=self.down>0.5
let fill=#d4d0c8
let tl=min(p.x,p.y)
let br=min(size.x-p.x,size.y-p.y)
let d=min(tl,br)
let upper=tl
0.5 && fd>=0.0 && fd<1.0 && dot {#000000}else{color}
// The wait spinner is drawn by the face, so a style that replaces the
// face wholesale drops it and a button left waiting looks idle. The
// hover and disabled mixes are deliberately NOT restored: neither style
// lit a button under the pointer, and the label carries the disabled
// state on its own, from draw_text, which no style replaces.
if self.loading>0.0 {
let sdf=Sdf2d.viewport(p)
sdf.clear(face)
let c=size*0.5
let r=max(min(size.x,size.y)*0.5-self.loading_inset,1.0)
let a0=self.anim_time*2.0*PI
sdf.arc_round_caps(c.x,c.y,r,a0,a0+1.5*PI,self.loading_stroke)
sdf.fill(vec4(self.loading_color.rgb,self.loading_color.a*self.loading))
return sdf.result
}
return face
}
// Sunken white edit fields, independent of the light theme's gradient material.
mod.widgets.TextInput.draw_bg.pixel = fn() {
let p=self.pos*self.rect_size
let size=self.rect_size
let sunken=true
let fill=if self.disabled>0.5 {#d4d0c8}else{#ffffff}
let tl=min(p.x,p.y)
let br=min(size.x-p.x,size.y-p.y)
let d=min(tl,br)
let upper=tl
0.5 {#d4d0c8}else{#ffffff}}
let q=p-vec2(size.x-18.0,2.0)
let bs=vec2(16.0,size.y-4.0)
if q.x>=0.0 && q.y>=0.0 && q.x0.5 || self.active>0.5
let face=if min(a,b)<1.0 {if (a=0.0 && ay<=3.0 && abs(q.x-bs.x*0.5)<=3.0-ay
return if arrow {if self.disabled>0.5 {#808080}else{#000000}}else{face}
}
return field
}
true
// Square two-line panel frames; the app keeps the same resident widgets.
mod.widgets.PanelView.draw_bg.bevel = 1.0
mod.widgets.PanelView.draw_bg.border_radius = 0.0