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

define * for rich text concatenation #4393

Open
ryofurue opened this issue Sep 21, 2024 · 0 comments
Open

define * for rich text concatenation #4393

ryofurue opened this issue Sep 21, 2024 · 0 comments
Labels
enhancement Feature requests and enhancements Makie Backend independent issues (Makie core) text

Comments

@ryofurue
Copy link

Feature description

I've found it useful to define * for Makie.RichText. I thought it would be a little nice addition. See below for an example to illustrate how it can be useful.

I sometimes write functions that call Makie functions and in my functions, I don't know the type of string arguments. They can be just Strings or Makie.RichTexts:

using CairoMakie
function Base.:*(x::Makie.RichText, y::AbstractString)
  rich(x, y)
end
function Base.:*(x::AbstractString, y::Makie.RichText)
  rich(x, y)
end

function plotsomething(title)
  mytitle = "hello, " * title * "!"
  # plot something using mytitle
end

plotsomething("x")
plotsomething(rich("x", superscript("y")))
@ryofurue ryofurue added the enhancement Feature requests and enhancements label Sep 21, 2024
@ffreyer ffreyer added Makie Backend independent issues (Makie core) text labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements Makie Backend independent issues (Makie core) text
Projects
None yet
Development

No branches or pull requests

2 participants