Skip to content

Detect currenttinytheme/modified tpar settings #556

@katrinabrock

Description

@katrinabrock

Hi,

I'm writing a package with plotting functionality based on tinyplot. I would like to set a custom default theme. So..if the user has not set any tinyplot theme, and they run my plotting function, my theme will be used. However, I would like to set it up such that if the user has configured a theme themselves (or set tpar in some other way), I don't trample it. Is there a way to achieve this with exported functions?

It looks like is.null(tinyplot:::get_environment_variable(".tpar_hooks")) will tell me if a theme is set or not so at least for the theme case, I could check this and apply my theme only if a theme is not already set.

I'm also seeing that tinyplot:::init_tpar sets the default tpar so maybe I could extract them in some way and then compare to current tpar to see if the user has changed anything away from the default?

Is there a recommended way to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions