Closed pragatibaheti closed 2 years ago
Yes, this can be used. Unfortunately, the Color
struct is still private so until it is made public you'll need to set the UseHex
property through reflection:
var colorType = typeof(AngleSharp.Css.CssKeywords).Assembly.GetType("AngleSharp.Css.Values.Color");
var useHex = colorType.GetProperty("UseHex", BindingFlags.Public | BindingFlags.Static);
useHex.SetValue(null, true);
Execute this prior to any calls to HtmlSanitizer methods.
Okay. Thanks
Color
is now public since AngleSharp.Css 0.16.4 so UseHex
can be used directly:
Watch out for potential threading issues if you intend to use both UseHex = true
and UseHex = false
from different threads.
Came across this modification in AngleSharp.css https://github.com/AngleSharp/AngleSharp.Css/issues/96 where they have modified to support hex color codes. Will this have any subsequent change in sanitization code. Basically how to use this while sanitizing. Any guide/snippet would help.
Thanks!