parent
a6a44febba
commit
d14aed8d7b
@ -0,0 +1,92 @@
|
||||
/* ——————————————————————————————————————————————————————————————————————————
|
||||
Proyecto WIAWAIW
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
Fichero mono_style_builder.go
|
||||
Package ansi
|
||||
Autor Juan V. Navarro juanvnl@activething.com
|
||||
Creado 20/08/2025
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
LICENSES AND TERMS OF USE
|
||||
-------------------------
|
||||
|
||||
This software is licensed under the Elastic License v2.0 (the "License").
|
||||
For full terms and additional information regarding permitted and prohibited
|
||||
uses, please visit:
|
||||
https://activething.com/wiawiaw/licenses
|
||||
|
||||
You may use, copy, modify, and redistribute this software internally within
|
||||
your organization for any purpose, including research, development, and
|
||||
testing, subject to the terms of this License.
|
||||
|
||||
You may NOT, however, use, provide, distribute, or make this software
|
||||
available to any third party as part of a hosted service, SaaS offering, or
|
||||
commercial product without first obtaining a commercial license from
|
||||
Active Thing.
|
||||
|
||||
You may combine this software with other code, provided that such
|
||||
combination does not circumvent the restrictions of this License.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. In no event shall
|
||||
the authors or copyright holders be liable for any claim, damages, or other
|
||||
liability arising from the use of this software.
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
Web : activething.com | wiawiaw.com
|
||||
git : g.activething.com | github.com/activething
|
||||
Correo : dev@activething.com
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
No deseo caminar sobre el agua", dijo Siddhartha.
|
||||
Que los antiguos chamanes se contenten con tales habilidades.
|
||||
—— Hermann Hesse, Siddhartha
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
Copyright (c) 2025 Active Thing
|
||||
————————————————————————————————————————————————————————————————————————————— */
|
||||
|
||||
package ansi
|
||||
|
||||
|
||||
|
||||
type (
|
||||
|
||||
MonoStyleBuilder struct {
|
||||
txtStyle TextStyle
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
|
||||
func NewMonoStyleBuilder(txtStyle TextStyle) *MonoStyleBuilder {
|
||||
return &MonoStyleBuilder{txtStyle: txtStyle.sanitize()}
|
||||
}
|
||||
|
||||
|
||||
func (s *MonoStyleBuilder) TextStyle () TextStyle { return s.txtStyle }
|
||||
|
||||
func (s *MonoStyleBuilder) SetTextStyle (txtStyle TextStyle) *MonoStyleBuilder {
|
||||
s.txtStyle = txtStyle.sanitize()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *MonoStyleBuilder) AddStyle (txtStyle TextStyle) { s.txtStyle = s.txtStyle.Add(txtStyle) }
|
||||
|
||||
func (s *MonoStyleBuilder) DelStyle (txtStyle TextStyle) { s.txtStyle = s.txtStyle.Del(txtStyle) }
|
||||
|
||||
|
||||
|
||||
|
||||
func (s *MonoStyleBuilder) Build () Style {
|
||||
if s.txtStyle == 0 {
|
||||
return ""
|
||||
}
|
||||
bf := make([]byte, 0,defaultAnsiBufferSize)
|
||||
bf = append(bf,ansiCodeBegin...)
|
||||
if s.txtStyle != 0 {
|
||||
bf = s.txtStyle.appendStyles(bf, false)
|
||||
}
|
||||
return Style(bf)
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/* ——————————————————————————————————————————————————————————————————————————
|
||||
Proyecto WIAWAIW
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
Fichero theme_manager.go
|
||||
Package ansi
|
||||
Autor Juan V. Navarro juanvnl@activething.com
|
||||
Creado 20/08/2025
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
LICENSES AND TERMS OF USE
|
||||
-------------------------
|
||||
|
||||
This software is licensed under the Elastic License v2.0 (the "License").
|
||||
For full terms and additional information regarding permitted and prohibited
|
||||
uses, please visit:
|
||||
https://activething.com/wiawiaw/licenses
|
||||
|
||||
You may use, copy, modify, and redistribute this software internally within
|
||||
your organization for any purpose, including research, development, and
|
||||
testing, subject to the terms of this License.
|
||||
|
||||
You may NOT, however, use, provide, distribute, or make this software
|
||||
available to any third party as part of a hosted service, SaaS offering, or
|
||||
commercial product without first obtaining a commercial license from
|
||||
Active Thing.
|
||||
|
||||
You may combine this software with other code, provided that such
|
||||
combination does not circumvent the restrictions of this License.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. In no event shall
|
||||
the authors or copyright holders be liable for any claim, damages, or other
|
||||
liability arising from the use of this software.
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
Web : activething.com | wiawiaw.com
|
||||
git : g.activething.com | github.com/activething
|
||||
Correo : dev@activething.com
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
No deseo caminar sobre el agua", dijo Siddhartha.
|
||||
Que los antiguos chamanes se contenten con tales habilidades.
|
||||
—— Hermann Hesse, Siddhartha
|
||||
—————————————————————————————————————————————————————————————————————————————
|
||||
Copyright (c) 2025 Active Thing
|
||||
————————————————————————————————————————————————————————————————————————————— */
|
||||
|
||||
package ansi
|
||||
|
||||
import "sync"
|
||||
|
||||
type ThemeManager struct {
|
||||
mu sync.RWMutex
|
||||
currentTheme *Theme
|
||||
capabilities Capabilities
|
||||
}
|
||||
Loading…
Reference in new issue