コード例 #1
0
 protected abstract void GenerateButtonOutlineVariantStyles(StringBuilder sb, Theme theme, string variant, ThemeButtonOptions buttonOptions);
コード例 #2
0
 protected abstract void GenerateButtonStyles(StringBuilder sb, Theme theme, ThemeButtonOptions options);
コード例 #3
0
        protected virtual void GenerateOutlineButtonColorVariables(Theme theme, string variant, string inBorderColor, ThemeButtonOptions options)
        {
            var borderColor = ParseColor(inBorderColor);

            if (borderColor.IsEmpty)
            {
                return;
            }

            var color       = ToHex(borderColor);
            var yiqColor    = ToHex(Contrast(theme, borderColor));
            var boxShadow   = ToHexRGBA(Transparency(borderColor, 127));
            var hoverColor  = ToHex(Lighten(borderColor, options?.HoverLightenColor ?? 20f));
            var activeColor = ToHex(Darken(borderColor, options?.ActiveDarkenColor ?? 20f));

            variables[ThemeVariables.OutlineButtonColor(variant)]          = color;
            variables[ThemeVariables.OutlineButtonYiqColor(variant)]       = yiqColor;
            variables[ThemeVariables.OutlineButtonBoxShadowColor(variant)] = boxShadow;
            variables[ThemeVariables.OutlineButtonHoverColor(variant)]     = hoverColor;
            variables[ThemeVariables.OutlineButtonActiveColor(variant)]    = activeColor;
        }
コード例 #4
0
        protected virtual void GenerateButtonColorVariables(Theme theme, string variant, string inBackgroundColor, string inBorderColor, ThemeButtonOptions options)
        {
            var backgroundColor = ParseColor(inBackgroundColor);
            var borderColor     = ParseColor(inBorderColor);

            if (backgroundColor.IsEmpty)
            {
                return;
            }

            var hoverBackgroundColor     = Darken(backgroundColor, options?.HoverDarkenColor ?? 15f);
            var hoverBorderColor         = Lighten(borderColor, options?.HoverLightenColor ?? 20f);
            var activeBackgroundColor    = Darken(backgroundColor, options?.ActiveDarkenColor ?? 20f);
            var activeBorderColor        = Lighten(borderColor, options?.ActiveLightenColor ?? 25f);
            var yiqBackgroundColor       = Contrast(theme, backgroundColor);
            var yiqHoverBackgroundColor  = Contrast(theme, hoverBackgroundColor);
            var yiqActiveBackgroundColor = Contrast(theme, activeBackgroundColor);

            var background          = ToHex(backgroundColor);
            var border              = ToHex(borderColor);
            var hoverBackground     = ToHex(hoverBackgroundColor);
            var hoverBorder         = ToHex(hoverBorderColor);
            var activeBackground    = ToHex(activeBackgroundColor);
            var activeBorder        = ToHex(activeBorderColor);
            var yiqBackground       = ToHex(yiqBackgroundColor);
            var yiqHoverBackground  = ToHex(yiqHoverBackgroundColor);
            var yiqActiveBackground = ToHex(yiqActiveBackgroundColor);

            var boxShadow = ToHexRGBA(Transparency(Blend(yiqBackgroundColor, backgroundColor, 15f), options?.BoxShadowTransparency ?? 127));

            variables[ThemeVariables.ButtonBackground(variant)]          = background;
            variables[ThemeVariables.ButtonBorder(variant)]              = border;
            variables[ThemeVariables.ButtonHoverBackground(variant)]     = hoverBackground;
            variables[ThemeVariables.ButtonHoverBorder(variant)]         = hoverBorder;
            variables[ThemeVariables.ButtonActiveBackground(variant)]    = activeBackground;
            variables[ThemeVariables.ButtonActiveBorder(variant)]        = activeBorder;
            variables[ThemeVariables.ButtonYiqBackground(variant)]       = yiqBackground;
            variables[ThemeVariables.ButtonYiqHoverBackground(variant)]  = yiqHoverBackground;
            variables[ThemeVariables.ButtonYiqActiveBackground(variant)] = yiqActiveBackground;
            variables[ThemeVariables.ButtonBoxShadow(variant)]           = boxShadow;
        }
コード例 #5
0
        protected virtual void GenerateButtonVariables(string variant, string inBackgroundColor, string inBorderColor, ThemeButtonOptions options)
        {
            var backgroundColor = ParseColor(inBackgroundColor);
            var borderColor     = ParseColor(inBorderColor);

            if (backgroundColor.IsEmpty)
            {
                return;
            }

            var hoverBackgroundColor     = Darken(backgroundColor, options?.HoverDarkenColor ?? 7.5f);
            var hoverBorderColor         = Lighten(borderColor, options?.HoverLightenColor ?? 10f);
            var activeBackgroundColor    = Darken(backgroundColor, options?.ActiveDarkenColor ?? 10f);
            var activeBorderColor        = Lighten(borderColor, options?.ActiveLightenColor ?? 12.5f);
            var yiqBackgroundColor       = Contrast(backgroundColor);
            var yiqHoverBackgroundColor  = Contrast(hoverBackgroundColor);
            var yiqActiveBackgroundColor = Contrast(activeBackgroundColor);

            var background          = ToHex(backgroundColor);
            var border              = ToHex(borderColor);
            var hoverBackground     = ToHex(hoverBackgroundColor);
            var hoverBorder         = ToHex(hoverBorderColor);
            var activeBackground    = ToHex(activeBackgroundColor);
            var activeBorder        = ToHex(activeBorderColor);
            var yiqBackground       = ToHex(yiqBackgroundColor);
            var yiqHoverBackground  = ToHex(yiqHoverBackgroundColor);
            var yiqActiveBackground = ToHex(yiqActiveBackgroundColor);

            var boxShadow = ToHexRGBA(Transparency(Blend(yiqBackgroundColor, backgroundColor, 15f), options?.BoxShadowTransparency ?? 127));

            variables[$"--b-button-{variant}-background"]            = background;
            variables[$"--b-button-{variant}-border"]                = border;
            variables[$"--b-button-{variant}-hover-background"]      = hoverBackground;
            variables[$"--b-button-{variant}-hover-border"]          = hoverBorder;
            variables[$"--b-button-{variant}-active-background"]     = activeBackground;
            variables[$"--b-button-{variant}-active-border"]         = activeBorder;
            variables[$"--b-button-{variant}-yiq-background"]        = yiqBackground;
            variables[$"--b-button-{variant}-yiq-hover-background"]  = yiqHoverBackground;
            variables[$"--b-button-{variant}-yiq-active-background"] = yiqActiveBackground;
            variables[$"--b-button-{variant}-box-shadow"]            = boxShadow;
        }
コード例 #6
0
        protected virtual void GenerateOutlineButtonVariables(string variant, string inBorderColor, ThemeButtonOptions options)
        {
            var borderColor = ParseColor(inBorderColor);

            if (borderColor.IsEmpty)
            {
                return;
            }

            var color     = ToHex(borderColor);
            var yiqColor  = ToHex(Contrast(borderColor));
            var boxShadow = ToHexRGBA(Transparency(borderColor, 127));

            variables[$"--b-outline-button-{variant}-color"]      = color;
            variables[$"--b-outline-button-{variant}-yiq-color"]  = yiqColor;
            variables[$"--b-outline-button-{variant}-box-shadow"] = boxShadow;
        }
コード例 #7
0
        protected virtual void GenerateOutlineButtonVariables(string variant, string inBorderColor, ThemeButtonOptions options)
        {
            var borderColor = ParseColor(inBorderColor);

            if (borderColor.IsEmpty)
            {
                return;
            }

            var color     = ToHex(borderColor);
            var yiqColor  = ToHex(Contrast(borderColor));
            var boxShadow = ToHexRGBA(Transparency(borderColor, 127));

            variables[ThemeVariables.OutlineButtonColor(variant)]          = color;
            variables[ThemeVariables.OutlineButtonYiqColor(variant)]       = yiqColor;
            variables[ThemeVariables.OutlineButtonBoxShadowColor(variant)] = boxShadow;
        }