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

\fbox fails to inherit color from css #1772

Closed
HenrySeed opened this issue Nov 2, 2018 · 6 comments
Closed

\fbox fails to inherit color from css #1772

HenrySeed opened this issue Nov 2, 2018 · 6 comments
Assignees

Comments

@HenrySeed
Copy link

When colouring a Katex rendered field with CSS, it mostly works great, however the \fbox latex tag fails to recolour itself, and stays black.

screen shot 2018-11-02 at 3 00 31 pm

Is it recommended to instead use some Latex form of colouring?

@edemaine
Copy link
Member

edemaine commented Nov 2, 2018

@HenrySeed Yes, \fbox uses the current LaTeX color. Try e.g. \color{red}\fbox{hi}:
image

You may want \fcolorbox, which lets you control the frame and background colors. See https://katex.org/docs/support_table.html

@HenrySeed
Copy link
Author

@edemaine Cool Ill use the \color tag. Is the coloring via HTML a supported feature or just an unintended side affect?

@kevinbarabash
Copy link
Member

kevinbarabash commented Feb 9, 2019

This is an interesting question. So setting the color using \textcolor from the xcolor package and rendering:

\textcolor{green}{\fbox{a couple of words}}

results in:
screen shot 2019-02-09 at 4 19 30 pm

This makes me think that if a CSS style updates the color of text it should also update the color \fbox.

@edemaine
Copy link
Member

edemaine commented Feb 9, 2019

@kevinbarabash Agreed, it seems intuitive for \fbox to use the "default color". It also seems to be technically possible, at least for \fbox: current we have a rule

.fbox { border: 0.04em solid black }

but if we replace it with the .fcolorbox rule:

.fcolorbox { border: 0.04em solid }

then the border seems to just inherit the current color (including a default of black).

@ronkok Do you think there would be downsides to this?

@ronkok
Copy link
Collaborator

ronkok commented Feb 9, 2019

No objections here.

@edemaine edemaine self-assigned this Feb 9, 2019
edemaine added a commit to edemaine/KaTeX that referenced this issue Feb 9, 2019
Merge `.fbox` and `.fcolorbox` rules to inherit default color, instead
of forcing `black`.  We no longer have any explicit `black` in CSS.
Fix KaTeX#1772.
@edemaine
Copy link
Member

edemaine commented Feb 9, 2019

Cool, then I put a PR together in #1847.

kevinbarabash pushed a commit that referenced this issue Feb 9, 2019
Merge `.fbox` and `.fcolorbox` rules to inherit default color, instead
of forcing `black`.  We no longer have any explicit `black` in CSS.
Fix #1772.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants