Skip to content

Allow decorations to change the background of a cell #3770

@Tyriar

Description

@Tyriar

VS Code issue: microsoft/vscode#147013

The goal with decorations was to make them as flexible as possible which I think we accomplished by using a DOM element. Unfortunately I think to really get the full potential of decorations we need some renderer integration as well in order to change the background color of a cell, otherwise we would only ever be able to overlay a transparent color on top which ends up washing out colors and making it impossible to align with the editor in VS Code for example.

Provided it's simple we could also support changing the foreground color, this isn't mandatory for what we need anything because of the minimum contrast ratio setting.

Something else to think about is whether to support the alpha channel in the new API which would blend with the original background color.

Proposal:

export interface IDecoration extends IDisposableWithEvent {
    // To be able to dynamically change the colors without recreating the decoration
    options: Pick<IDecorationOptions, 'overviewRulerOptions' | 'backgroundColor' | 'foregroundColor'>;
}

export interface IDecorationOptions {
    /**
     * The background color of the cell(s).
     */
    backgroundColor?: string;
    
    /**
     * The foreground color of the cell(s).
     */
    foregroundColor?: string;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions