Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply text opacity decoration without setting text color #43004

Closed
grdowns opened this issue Feb 6, 2018 · 2 comments · Fixed by #47536
Closed

Apply text opacity decoration without setting text color #43004

grdowns opened this issue Feb 6, 2018 · 2 comments · Fixed by #47536
Assignees
Labels
api editor-rendering Editor rendering issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@grdowns
Copy link

grdowns commented Feb 6, 2018

I'm working on the C++ extension here at Microsoft. One of our features for this release is inactive region colorization, similar to Visual Studio. While we've achieved end to end, there are a couple "nice to have" changes that would make the feature shine more. For modularity's sake I will expound upon just one here.

We would like a way to modify only the opacity of text without modifying other properties. We are using vscode.TextEditor.setDecorations to apply a text decoration to the inactive region. vscode.TextEditor.setDecorations applies properties filled out in a vscode.DecorationRenderOptions. However, this interface does not allow for directly setting the opacity of the text without modifying the other color properties. E.g. supplying rgba:(150,150,150,0.5) will set the opacity with the unwanted side effect of changing the color to gray.

Are there other means of setting the text opacity unaware to us? If not, we would greatly appreciate having such a thing implemented to give the user an experience more comparable to Visual Studio.

@mjbvz
Copy link
Collaborator

mjbvz commented Mar 26, 2018

As part of #15710, I'd also like to do the same for JS and TS

mjbvz added a commit to mjbvz/vscode that referenced this issue Apr 10, 2018
Adds a new opacity option for text decorations. This controls the opacity of the text (it does not effect the border or background added by the decoration since those already have alpha channels)

Fixes microsoft#43004
@alexdima alexdima assigned mjbvz and unassigned rebornix Apr 10, 2018
@alexdima alexdima added api editor-rendering Editor rendering issues and removed editor-core Editor basic functionality labels Apr 10, 2018
@alexdima alexdima added this to the April 2018 milestone Apr 10, 2018
@alexdima alexdima added feature-request Request for new features or functionality and removed editor labels Apr 10, 2018
@mjbvz mjbvz added the verification-needed Verification of issue is requested label Apr 23, 2018
@alexdima
Copy link
Member

Verified using the following extension:

  • package.json:
{
    "publisher": "alex",
    "name": "43004",
    "version": "0.0.0",
    "engines": {
        "vscode": "^1.0.0"
    },
    "activationEvents": [
        "*"
    ],
    "main": "index.js"
}
  • index.js:
const vscode = require('vscode');

exports.activate = function () {
	var dectype = vscode.window.createTextEditorDecorationType({
		opacity: '0.5'
	});
	vscode.window.activeTextEditor.setDecorations(dectype, [
		new vscode.Range(0, 0, 0, 1),
		new vscode.Range(1, 0, 1, 1),
		new vscode.Range(2, 0, 2, 1),
		new vscode.Range(3, 0, 3, 1),
		new vscode.Range(4, 0, 4, 1),
		new vscode.Range(5, 0, 5, 1),
		new vscode.Range(6, 0, 6, 1),
		new vscode.Range(7, 0, 7, 1),
		new vscode.Range(8, 0, 8, 1),
		new vscode.Range(9, 0, 9, 1),
	]);
}

image

@alexdima alexdima added the verified Verification succeeded label Apr 24, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators May 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api editor-rendering Editor rendering issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants