Skip to content

morgansleeper/SailorMoonR

Repository files navigation

SailorMoonR 🌙

Transform your R plots and graphics with the magical colors of Sailor Moon! 🌙✨🌸

Installation

install.packages("devtools") #If you don't already have devtools installed

devtools::install_github("morgansleeper/SailorMoonR")

Using SailorMoonR

#Load SailorMoonR
library(SailorMoonR)

Functions:

  • MoonPaletteEnumeration: list all available palettes
  • MoonPaletteIllumination(): generate a sample swatch for a palette
  • inthenameofthemoon(): use a palette (by having it return its color values)
# See all available palettes
MoonPaletteEnumeration
>  [1] "MoonPrismPower"        "MoonTiaraAction"       "MoonHealingEscalation"
>  [4] "MoonPrincessHalation"  "ShabonSpray"           "ShineAquaIllusion"    
>  [7] "AkuryoTaisan"          "FireSoul"              "SparklingWidePressure"
> [10] "JupiterOakEvolution"   "VenusLoveMeChain"      "CrescentBeam"         
> [13] "MinatoDaylight"        "MinatoSunset"          "MinatoMoonlight"      
> [16] "TokyoTower"

# See a sample swatch for a palette
MoonPaletteIllumination("MoonPrismPower")

# Use a palette
inthenameofthemoon("MoonPrismPower")
> [1] "#FF0083" "#0C1EB8" "#00A294" "#FFBC4D"

Prism:

If you need more colors than a given palette offers, you can generate a larger palette by adding the prism argument:

#Expand a palette with prism
inthenameofthemoon("CrescentBeam", prism=6)
> [1] "#862699" "#357BA9" "#00B2BD" "#00A9D8" "#56C9ED" "#D7FEFF"

MoonPaletteIllumination("MinatoSunset", prism=128)

Palettes

Sailor Moon 🌙

inthenameofthemoon("MoonPrismPower")

inthenameofthemoon("MoonTiaraAction")

inthenameofthemoon("MoonHealingEscalation")

inthenameofthemoon("MoonPrincessHalation")

Sailor Mercury ☿

inthenameofthemoon("ShabonSpray")

inthenameofthemoon("ShineAquaIllusion")

Sailor Mars ♂️

inthenameofthemoon("AkuryoTaisan")

inthenameofthemoon("FireSoul")

Sailor Jupiter ♃

inthenameofthemoon("SparklingWidePressure")

inthenameofthemoon("JupiterOakEvolution")

Sailor Venus ♀️

inthenameofthemoon("VenusLoveMeChain")

inthenameofthemoon("CrescentBeam")

Tokyo 🌃

inthenameofthemoon("MinatoDaylight")

inthenameofthemoon("MinatoSunset")

inthenameofthemoon("MinatoMoonlight")

inthenameofthemoon("TokyoTower")

Examples

ggplot2 📊

library(ggplot2)

ggplot(distances, aes(x=Planet, y=Distance, fill=Planet)) +
  geom_col() +
  xlab("") + ylab("Distance from Sun (AU)") +
  scale_fill_manual(values = inthenameofthemoon("MoonTiaraAction")) +
  guides(fill=FALSE)

leaflet 🗺

library(leaflet)

#Set up color palette
pal <- colorFactor(palette = (col=(inthenameofthemoon("MoonPrismPower"))), domain = locs$Type)

#Draw map
leaflet(locs) %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  addMarkers(label=~Name) %>%
  addCircles(radius=150, weight=1, color=~pal(Type)) %>%
  addLegend("topright", pal = pal, values = ~locs$Type, title = "Location type", opacity = .4) %>%
  addMiniMap("bottomright", width=100, height=100, tiles = providers$CartoDB.Positron)

seewave 🌊

library(seewave)

spectro(tico, palette=colorRampPalette(inthenameofthemoon("MinatoSunset")),
  collevels=seq(-50,0,1), osc=TRUE, flim=c(2,6), tlim=c(0.5,1.4), heights=c(4,2))

image 🌋

image(volcano, col=inthenameofthemoon("MinatoMoonlight", prism=32), axes=FALSE)
title(sub="Maungawhau", family = "sans", line=0.5, font.sub=2, cex.sub=1.2)

Acknowledgments & extras

Project inspired by Karthik Ram’s Wes Anderson Palettes package.

Written using and pairs nicely with sailorhg’s fairyfloss theme (RStudio version available here).

Sailor Moon © Naoko Takeuchi.