1

I found the flycheck-pos-tip package uses a function defined in pos-tip-show which uses a built-in function: x-show-tip.

I want to change the background color of x-show-tip to be transparent.

There is a custom variable named pos-tip-background-color in the pos-tip package, how can I change this value to transparent? For example, the value of pos-tip-background-color is #FF0000, how can I change its alpha value to 50, so that I get a color of RGBA(255,0,0,0.5) if I use a CSS style value.

enter image description here

1

You can't make a frame background transparent by changing the background color. The alpha frame parameter is a separate parameter from background-color.

Function x-show-tip accepts an alist of tooltip frame parameters as argument. If you are the caller of x-show-tip then you can add an alpha parameter and its value to the alist that you pass to x-show-tip.

Example:

(x-show-tip "HELLO" nil '((alpha . 20))) ; Show 80%-transparent tooltip 

Here's an image showing the effect:

enter image description here

However, the call to x-show-tip in pos-tip-show-no-propertize is beyond your control in this regard: it hard-codes the parameter alist.

You could, however, advise or redefine pos-tip-show-no-propertize, giving yourself the possibility of modifying the parameters it passes to x-show-tip.

But pos-tip.el apparently doesn't offer any non-surgical way to do what you want. You might want to consider requesting such a possibility from the maintainer of pos-tip.el. S?he could, for example, add an optional argument that lets a caller pass the alist, defaulting to the alist that is currently hard-coded.

  • Hi, I found if I change the frame parameter using (set-frame-parameter mframe 'alpha 0.8) before x-show-tip is called, or append (alpha . 0.8) to the parms parameter of x-show-tip,the whole frame is made transparent, rather than only the tip being transparent. How to make the tip itself be transparent without affecting the whole frame? – cmal Oct 28 '18 at 11:24
  • Sorry, last message 0.8 just means 80. – cmal Oct 28 '18 at 11:37
  • Sorry - I mistakenly said that the FRAME argument to x-show-tip was for the tooltip frame. I've edited the text to correct this, and I've provided an example that shows a tooltip with 80% transparency (20% opacity). HTH. – Drew Oct 28 '18 at 13:19
  • It seems not make the tip transparent. I paste the screenshot in the body of my quest. Thank you for your help, though. – cmal Oct 29 '18 at 2:25
  • Works for me. Maybe it depends what platform you're on. I added a screenshot. I'm using MS Windows. – Drew Oct 29 '18 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.