protected override void GenerateSwitchVariantStyles(StringBuilder sb, Theme theme, string variant, string inBackgroundColor, ThemeSwitchOptions options)
        {
            var backgroundColor = ParseColor(inBackgroundColor);

            if (backgroundColor.IsEmpty)
            {
                return;
            }

            var boxShadowColor          = Lighten(backgroundColor, options?.BoxShadowLightenColor ?? 25);
            var disabledBackgroundColor = Lighten(backgroundColor, options?.DisabledLightenColor ?? 50);

            var background         = ToHex(backgroundColor);
            var boxShadow          = ToHex(boxShadowColor);
            var disabledBackground = ToHex(disabledBackgroundColor);

            sb
            .Append($".form-check.form-switch .form-check-input.form-check-input-{variant}:checked").Append("{")
            .Append($"background-color: {background};")
            .Append($"border-color: {background};")
            .AppendLine("}");

            //sb
            //    .Append( $".custom-switch .custom-control-input.custom-control-input-{variant}:focus ~ .custom-control-label::before" ).Append( "{" )
            //    .Append( $"box-shadow: {boxShadow};" )
            //    .Append( $"border-color: {background};" )
            //    .AppendLine( "}" );

            //sb
            //    .Append( $".custom-switch .custom-control-input:disabled.custom-control-input-{variant}:checked ~ .custom-control-label::before" ).Append( "{" )
            //    .Append( $"background-color: {disabledBackground};" )
            //    .AppendLine( "}" );
        }
Exemplo n.º 2
0
        protected override void GenerateSwitchVariantStyles(StringBuilder sb, Theme theme, string variant, string inBackgroundColor, ThemeSwitchOptions options)
        {
            var backgroundColor = ParseColor(inBackgroundColor);

            if (backgroundColor.IsEmpty)
            {
                return;
            }

            //var boxShadowColor = Lighten( backgroundColor, options?.BoxShadowLightenColor ?? 25 );
            var disabledBackgroundColor = Lighten(backgroundColor, options?.DisabledLightenColor ?? 50);

            var background = ToHex(backgroundColor);
            //var boxShadow = ToHex( boxShadowColor );
            var disabledBackground = ToHex(disabledBackgroundColor);

            sb
            .Append($".switch[type=\"checkbox\"].is-{variant}:checked + label::before,")
            .Append($".switch[type=\"checkbox\"].is-{variant}:checked + label:before").Append("{")
            .Append($"background-color: {background};")
            .AppendLine("}");

            sb
            .Append($".switch[type=\"checkbox\"]:disabled.is-{variant}:checked + label::before").Append("{")
            .Append($"background-color: {disabledBackground};")
            .AppendLine("}");
        }
Exemplo n.º 3
0
        protected override void GenerateSwitchVariantStyles(StringBuilder sb, Theme theme, string variant, string inBackgroundColor, ThemeSwitchOptions options)
        {
            var backgroundColor = ParseColor(inBackgroundColor);

            if (backgroundColor.IsEmpty)
            {
                return;
            }

            var boxShadowColor          = Lighten(backgroundColor, options?.BoxShadowLightenColor ?? 25);
            var disabledBackgroundColor = Lighten(backgroundColor, options?.DisabledLightenColor ?? 50);

            var background         = ToHex(backgroundColor);
            var boxShadow          = ToHex(boxShadowColor);
            var disabledBackground = ToHex(disabledBackgroundColor);

            sb
            .Append($".ant-switch.ant-switch-{variant}.ant-switch-checked").Append("{")
            .Append($"background-color: {background};")
            .AppendLine("}");

            sb
            .Append($".ant-switch.ant-switch-{variant}:focus").Append("{")
            .Append($"box-shadow: {boxShadow};")
            .AppendLine("}");

            sb
            .Append($".ant-switch:disabled.ant-switch-{variant}.ant-switch-checked").Append("{")
            .Append($"background-color: {disabledBackground};")
            .AppendLine("}");
        }
Exemplo n.º 4
0
 protected override void GenerateSwitchVariantStyles(StringBuilder sb, Theme theme, string variant, string inBackgroundColor, ThemeSwitchOptions switchOptions)
 {
     throw new System.NotImplementedException();
 }