Esempio n. 1
0
        public static Func <string, string> Build(string oneStyle, IColorPalette palette = null)
        {
            var adapter = new AnsiConsoleAdapter(palette);
            var printer = TextStyleGenerator.GeneratePrinter(adapter);

            return(text => printer($"{oneStyle}`{text}`"));
        }
Esempio n. 2
0
        public AliasColorScheme(IColorPalette sourceColorPalette, IAliasMapping aliasMapping)
        {
            _sourceColorPalette = sourceColorPalette;
            _aliasMapping       = aliasMapping;

            InitAliasColorMappings();
        }
        public static Bitmap?DoRender(IVisualElement view,
                                      StaticGdiRenderKit renderKit,
                                      Color?backgroundColor,
                                      Double dpi,
                                      ValueRenderSize availableSize,
                                      IColorPalette colorPalette)
        {
            var viewState = new StaticViewState(dpi, colorPalette);


            var desired = renderKit.MeasureContext.MeasureMainView(view, availableSize,
                                                                   viewState);

            if (!desired.IsValid)
            {
                return(default);
        public StyleVariableAccessor(IColorPalette colorPalette)
        {
            _lock     = new Object();
            _values   = new Dictionary <String, Object?>();
            _promises = new Dictionary <String, Delegate>();

            foreach (var kvp in colorPalette)
            {
                var name = $"--mat-{kvp.Key.ToString().ToLower()}";
                SetVariableValue(name, kvp.Value);

                if (kvp.Value is SolidColorBrush scb)
                {
                    //var rgb = $"{scb.Color.R},{scb.Color.G},{scb.Color.B}";
                    var rgb = new Object[] { scb.Color.R, scb.Color.G, scb.Color.B };
                    SetVariableValue($"{name}-rgb", rgb);
                }
            }
        }
        public BaseStyleContext(IStyle defaultStyle,
                                IColorPalette colorPalette,
                                IStyleVariableAccessor variableAccessor)
        {
            ColorPalette = colorPalette;
            AssertStyleValidity(defaultStyle, true);
            _defaultStyle     = defaultStyle;
            _variableAccessor = variableAccessor;

            _elementStyles = new Dictionary <Int32, ElementStyle>();
            _cachedStyles  = new Dictionary <Int32, IStyle>();
            _typeStyles    = new Dictionary <Type, List <ScopedStyle> >();

            if (defaultStyle is IStyleSheet sheet)
            {
                //throw new NotImplementedException();
                foreach (var kvp in sheet.VisualTypeStyles)
                {
                    RegisterStyle(kvp.Value);
                }
            }

            RegisterMaterialColors(colorPalette, variableAccessor);
        }
Esempio n. 6
0
 public StaticViewState(Double zoomLevel,
                        IColorPalette colorPalette)
 {
     ZoomLevel    = zoomLevel;
     ColorPalette = colorPalette;
 }
Esempio n. 7
0
 public BasicHtmlAdapter(IColorPalette palette = null)
 {
     Palette = palette ?? new ColorPaletteTerminal();
 }
 private static void RegisterMaterialColors(IColorPalette colorPalette,
                                            IStyleVariableAccessor variableAccessor)
 {
     variableAccessor.SetVariableValue("--pure-material-onsurface-rgb",
                                       () => colorPalette.OnSurface);
 }
Esempio n. 9
0
 public FftRenderer(IColorPalette palette)
 {
     this.palette = palette;
 }
Esempio n. 10
0
 public ColorPalette(IColorPalette palette)
 {
     Pal  = palette ?? new ColorPalettes.Category10();
     Name = palette.GetType().Name;
 }
Esempio n. 11
0
 public AnsiConsoleAdapter(IColorPalette palette = null)
 {
     Palette = palette ?? new ColorPaletteTerminal();
 }