forked from mbk-lab/rui_orig
2
0
Fork 0

Added "accent-color" property

This commit is contained in:
Alexei Anoshenko 2022-08-20 19:13:51 +03:00
parent 7c860c54b9
commit 06ccffa900
6 changed files with 15 additions and 2 deletions

View File

@ -2,10 +2,10 @@
* Requires go 1.18 or higher
* The "interface{}" type replaced by "any"
* Added "overflow", "arrow", "arrow-align", "arrow-size", "arrow-width", and "arrow-offset" properties
* Added "accent-color", "overflow", "arrow", "arrow-align", "arrow-size", "arrow-width", and "arrow-offset" properties
* Added "@ruiArrowSize" and "@ruiArrowWidth" constants to the default theme
* Added Transition, Transitions, and SetTransition functions to the ViewStyle interface
* Added GetOverflow, IsTimingFunctionValid, and GetTransitions functions
* Added GetAccentColor, GetOverflow, IsTimingFunctionValid, and GetTransitions functions
* Changed GetTransition functions
* Added the OpenURL function to the Session interface

View File

@ -74,6 +74,7 @@ theme {
text-size = 10pt,
text-color = @ruiTextColor,
background-color = @ruiBackgroundColor,
accent-color = @ruiHighlightColor,
},
ruiButton {
align = center,

View File

@ -147,6 +147,10 @@ const (
// The "padding-bottom" SizeUnit property sets the height of the padding area to the bottom of a view.
PaddingBottom = "padding-bottom"
// AccentColor is the constant for the "accent-color" property tag.
// The "accent-color" property sets sets the accent color for UI controls generated by some elements.
AccentColor = "accent-color"
// BackgroundColor is the constant for the "background-color" property tag.
// The "background-color" property sets the background color of a view.
BackgroundColor = "background-color"

View File

@ -637,6 +637,7 @@ func viewPropertyChanged(view *viewData, tag string) {
TextColor: "color",
TextLineColor: "text-decoration-color",
CaretColor: CaretColor,
AccentColor: AccentColor,
}
if cssTag, ok := colorTags[tag]; ok {
if color, ok := colorProperty(view, tag, session); ok {

View File

@ -224,6 +224,7 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
{TextColor, "color"},
{TextLineColor, "text-decoration-color"},
{CaretColor, CaretColor},
{AccentColor, AccentColor},
}
for _, p := range colorProperties {
if color, ok := colorProperty(style, p.property, session); ok && color != 0 {

View File

@ -326,6 +326,12 @@ func GetBackgroundColor(view View, subviewID string) Color {
return colorStyledProperty(view, subviewID, BackgroundColor, false)
}
// GetAccentColor returns the accent color for UI controls generated by some elements.
// If the second argument (subviewID) is "" then a value from the first argument (view) is returned.
func GetAccentColor(view View, subviewID string) Color {
return colorStyledProperty(view, subviewID, AccentColor, false)
}
// GetFontName returns the subview font.
// If the second argument (subviewID) is "" then a value from the first argument (view) is returned.
func GetFontName(view View, subviewID string) string {