This function provides a convenient way to apply Microsoft themed color scales and aesthetics to ggplot2 plots. The user can specify whether they want a continuous or discrete theme by providing the `scale_type` argument.

theme_microsoft(
  scale_type = c("discrete", "continuous"),
  index = NULL,
  direction = 1,
  guide = "legend",
  fallback_font = "sans"
)

Arguments

scale_type

A character string specifying the type of scale, either "continuous" or "discrete". Default is "discrete".

index

An optional numeric index or vector of indices to select specific colors from the Microsoft color palette.

direction

An optional numeric value (1 or -1) specifying the direction of the color gradient for continuous scales. Default is 1.

guide

An optional character string specifying the type of guide to use for continuous scales. Default is 'legend'.

fallback_font

Adds a fallback font of 'sans' in case user does not have required font.

Value

A list containing the ggplot2 theme, fill scale, and color scale.

Examples

if (FALSE) {
library(ggplot2)

# Example with continuous theme
ggplot(mtcars, aes(x = wt, y = mpg, color = qsec)) +
  geom_point() +
  theme_microsoft(scale_type = "continuous")

# Example with discrete theme
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
  geom_point() +
  theme_microsoft(scale_type = "discrete")
  }