r4fun / hierplane

🌳 Hierplane for R
https://r4fun.github.io/hierplane/
Other
9 stars 0 forks source link

Pink and grey themes! #40

Closed mathidachuk closed 4 years ago

mathidachuk commented 4 years ago

try them out :)

library(hierplane)

# grey demo
txt <- "By the time a cat is 9 years old, it will only have been awake for three years of its life."

settings <- hierplane:::spacyr_default()
settings$node_type <- "pos"
settings$attributes <- settings$attributes[!settings$attributes %in% "pos"]

styles <- hierplane_styles(
  node_type_to_style = list(
       ADV = "color6",
      PRON = "color6",
      VERB = "color3",
       ADJ = "color4",
       NUM = "color4",
     PUNCT = "color8",
       ADP = "color6",
       AUX = "color6",
       DET = "color3",
      NOUN = "color2"
  )
)

txt_json <- hp_spacyr(txt, settings = settings, styles = styles)

hierplane(txt_json, theme = "grey")

# pink demo

styles <- hierplane_styles(
  node_type_to_style = list(
    ROOT = c("color1", "strong"),
    Original = "color3", 
    Prequel = "color3",
    Sequel = "color5",
    ship = "color6"
  ),
  link_to_positions = list(
    Prequel = "left",
    Original = "right",
    ship = "right"
  ),
  link_name_to_label = list(
    Prequel = "PRE",
    Original = "OG",
    Sequel = "SEQ"
  )
)

hierplane(hp_dataframe(starships, styles = styles), theme = "pink")
tylerlittlefield commented 4 years ago

Love this, thank you! You should take a look at https://pkg.garrickadenbuie.com/xaringanthemer/. Since you are familiar with the CSS, you can probably make a function that basically allows people to create their own hierplane themes. Something like hierplane_themer() or something. Anyway, I think this looks great, I am going to merge.