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

Passthrough length & color arguments to text and box #23

Open
nopeslide opened this issue Feb 21, 2024 · 3 comments
Open

Passthrough length & color arguments to text and box #23

nopeslide opened this issue Feb 21, 2024 · 3 comments

Comments

@nopeslide
Copy link
Contributor

Small usage improvement.
Every field represents some text at the end and afaik fields do not use length or color arguments.
instead of

bytes(3)[
  #box(width:100%,height:100%,fill:green)[
    #text(8pt)[
      my bytes
    ]
  ]
]

passthrough length arguments to text and color arguments as box fill

bytes(3,8pt,green)[my bytes]
@jomaway
Copy link
Owner

jomaway commented Feb 21, 2024

There is already a named argument fill for the background color.

Example: bytes(3, fill: green)[Text] produces a field with green background.

I not sure if there is a benefit of removing the named argument instead of just a passthrough color.

Actually with the size i think it is not obvious where it belongs to. If we think about for example having a option to specify the desired rowhigh for a field, this could be confusing. But adding a argument text-size like in the header is probably a good idea.

Beside that you can very easily create a wrapper like let my_bytes(size, fontsize, color, body) = bytes(size, fill: color)[#text(textsize, body)]. This would keep the default implementation slim.

But i would like to add a global option for the default font size inside a field, through the bytefield function for just that bytefield or the bf-config for all bytefields.

@nopeslide
Copy link
Contributor Author

Beside that you can very easily create a wrapper like let my_bytes(size, fontsize, color, body) = bytes(size, fill: color)[#text(textsize, body)]. This would keep the default implementation slim.

I already wrote so many wrappers :D
this was just something I did often, so I thought it could be a default feature

Actually with the size i think it is not obvious where it belongs to. If we think about for example having a option to specify the desired rowhigh for a field, this could be confusing. But adding a argument text-size like in the header is probably a good idea.

I always think the unnamed args should reflect common options.
manipulating the row height should be rare use case,
but manipulating the text size so the text fits inside the cell is a common one, isn't it?

There is already a named argument fill for the background color.

must have overlooked this one

@jomaway
Copy link
Owner

jomaway commented Mar 9, 2024

Just to give a short update on the current status on this one. Now it is possible to set a global font size for all data fields as part of the global setup (See #31). This might be helpful if you want to set a different font size as the default font size in your document. If none is specified this will fallback to the font size set on the document itself.

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

2 participants