Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
26 lines
935 B
Go
26 lines
935 B
Go
package scene
|
|
|
|
import "math"
|
|
|
|
// Oklab returns c, in sRGB, in the Oklab color space, as the renderers
|
|
// mix gradients in it: the CPU's from this, the GPU's from the stops'
|
|
// values it gives them, or from the same math in their shaders.
|
|
func Oklab(c Color) [3]float32 {
|
|
r, g, b := toLinear(float32(c.R)/255), toLinear(float32(c.G)/255), toLinear(float32(c.B)/255)
|
|
l := float32(math.Cbrt(float64(0.4122214708*r + 0.5363325363*g + 0.0514459929*b)))
|
|
m := float32(math.Cbrt(float64(0.2119034982*r + 0.6806995451*g + 0.1073969566*b)))
|
|
s := float32(math.Cbrt(float64(0.0883024619*r + 0.2817188376*g + 0.6299787005*b)))
|
|
return [3]float32{
|
|
0.2104542553*l + 0.7936177850*m - 0.0040720468*s,
|
|
1.9779984951*l - 2.4285922050*m + 0.4505937099*s,
|
|
0.0259040371*l + 0.7827717662*m - 0.8086757660*s,
|
|
}
|
|
}
|
|
|
|
func toLinear(c float32) float32 {
|
|
if c <= 0.04045 {
|
|
return c / 12.92
|
|
}
|
|
return float32(math.Pow(float64((c+0.055)/1.055), 2.4))
|
|
}
|