Giter Club home page Giter Club logo

Comments (4)

wieslawsoltes avatar wieslawsoltes commented on June 18, 2024

https://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#color-units

The format of an RGB value in hexadecimal notation is a '#' immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.

There is fill-opacity and stroke-opacity https://www.w3.org/TR/SVG11/painting.html

from svg.skia.

danipen avatar danipen commented on June 18, 2024

aarrggbb formats are valid in avalonia so this is the reason I was using that way. I can workaround removing that alpha channel before sending it to SVG.Skia.

The reason I reported it is because I'm previous SVG.Skia it worked fine.

from svg.skia.

wieslawsoltes avatar wieslawsoltes commented on June 18, 2024

aarrggbb formats are valid in avalonia so this is the reason I was using that way. I can workaround removing that alpha channel before sending it to SVG.Skia.

The reason I reported it is because I'm previous SVG.Skia it worked fine.

There have been many changes in the parsing code for Color and some issues with Microsoft deprecating System.Drawing cross-platform support so it might have changed. There are are some gray areas in svg standard compliance, not sure we can make it work here.

from svg.skia.

danipen avatar danipen commented on June 18, 2024

I place here my workaround for reference:

            static string GetIconForegroundColor(ThemeBrushes.Name color)
            {
                ISolidColorBrush result = (ISolidColorBrush)ThemeBrushes.GetBrush(color);
                return RemoveAlpha(result.Color.ToString());
            }

            static string RemoveAlpha(string hexColor)
            {
                // #aarrggb colors are not supported anymore in Svg.Skia
                // so we need to remove the alpha part here
                // https://github.com/wieslawsoltes/Svg.Skia/issues/118
                if (hexColor.Length != 9 || !hexColor.ToLowerInvariant().StartsWith("#ff"))
                    return hexColor;

                return stackalloc char[]
                {
                    '#',
                    hexColor[3], hexColor[4],
                    hexColor[5], hexColor[6],
                    hexColor[7], hexColor[8]
                }.ToString();
            }

from svg.skia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.