npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fullcalendar-spotheme

v1.0.0

Published

SharePoint Online theme integration for FullCalendar - automatically style your calendar with SPFx web part themes

Downloads

11

Readme

FullCalendar SharePoint Theme

A TypeScript library that applies SharePoint Online themes from SPFx web parts to FullCalendar, automatically styling calendar buttons and components based on your SharePoint site's theme.

Features

  • 🎨 Automatically applies SharePoint theme colors to FullCalendar
  • 🔘 Styles buttons with primary and secondary SharePoint theme colors
  • 📱 Responsive and mobile-friendly
  • 🎯 Fluent UI design language integration
  • 🔧 TypeScript support with full type definitions
  • ⚡ Zero dependencies (peer dependencies only)
  • 🎭 Supports both light and dark SharePoint themes

Installation

npm install fullcalendar-spotheme

Peer Dependencies

{
  "@fullcalendar/core": ">=6",
  "@fullcalendar/react": ">=6",
  "react": ">=17"
}

Usage

Basic Usage in SPFx Web Part

import { applySharePointTheme } from 'fullcalendar-spotheme';
import 'fullcalendar-spotheme/dist/fullcalendar-theme.css';

export default class MyCalendarWebPart extends BaseClientSideWebPart<IMyWebPartProps> {
  
  public render(): void {
    // Get the SharePoint theme from context
    const spTheme = this.context.sdks?.microsoftTeams?.theme || 
                    this.context.theme;
    
    // Apply the theme to FullCalendar
    applySharePointTheme({
      spTheme: spTheme
    });

    // Render your FullCalendar component
    const element: React.ReactElement = React.createElement(
      MyCalendarComponent,
      {
        // your props
      }
    );

    ReactDom.render(element, this.domElement);
  }
}

With Scoped Selector

If you want to scope the theme to a specific container:

applySharePointTheme({
  spTheme: this.context.theme,
  scopeSelector: '#my-calendar-container'
});

React Component Example

import React, { useEffect, useRef } from 'react';
import FullCalendar from '@fullcalendar/react';
import dayGridPlugin from '@fullcalendar/daygrid';
import { applySharePointTheme, IReadonlyTheme } from 'fullcalendar-spotheme';
import 'fullcalendar-spotheme/dist/fullcalendar-theme.css';

interface IMyCalendarProps {
  theme: IReadonlyTheme;
}

const MyCalendar: React.FC<IMyCalendarProps> = ({ theme }) => {
  const themeRef = useRef<any>();

  useEffect(() => {
    // Apply theme on mount and get theme controller
    themeRef.current = applySharePointTheme({
      spTheme: theme,
      scopeSelector: '.my-calendar-wrapper'
    });

    // Cleanup on unmount
    return () => {
      themeRef.current?.remove();
    };
  }, []);

  // Update theme when it changes
  useEffect(() => {
    if (themeRef.current) {
      themeRef.current.update(theme);
    }
  }, [theme]);

  return (
    <div className="my-calendar-wrapper">
      <FullCalendar
        plugins={[dayGridPlugin]}
        initialView="dayGridMonth"
        headerToolbar={{
          left: 'prev,next today',
          center: 'title',
          right: 'dayGridMonth,dayGridWeek,dayGridDay'
        }}
        events={[
          { title: 'Meeting', date: '2026-01-15' },
          { title: 'Conference', date: '2026-01-20' }
        ]}
      />
    </div>
  );
};

export default MyCalendar;

Manual CSS Variable Access

If you want to get the CSS variables without auto-injection:

import { getThemeVariables, getThemeCSS } from 'fullcalendar-spotheme';

// Get variables as an object
const variables = getThemeVariables(spTheme);
console.log(variables['--fc-button-bg-color']); // e.g., "#0078d4"

// Get CSS string
const cssString = getThemeCSS(spTheme, ':root');
// Apply manually or save to file

Without Auto-Injection

const themeResult = applySharePointTheme({
  spTheme: spTheme,
  autoInject: false
});

// Manually inject later
const styleElement = document.createElement('style');
styleElement.textContent = themeResult.css;
document.head.appendChild(styleElement);

API Reference

applySharePointTheme(options)

Main function to apply SharePoint theme to FullCalendar.

Parameters:

  • options.spTheme (required): SharePoint theme object from SPFx context
  • options.scopeSelector (optional): CSS selector to scope theme (default: :root)
  • options.autoInject (optional): Auto-inject styles into document (default: true)

Returns:

{
  variables: Record<string, string>;  // CSS variables object
  css: string;                         // Generated CSS string
  update: (newTheme) => void;          // Update theme dynamically
  remove: () => void;                   // Remove injected styles
}

getThemeVariables(spTheme)

Get theme CSS variables as an object without injecting styles.

getThemeCSS(spTheme, scopeSelector?)

Generate CSS string from SharePoint theme.

Available CSS Variables

The library generates the following CSS variables:

Button Variables

  • --fc-button-bg-color - Primary button background
  • --fc-button-border-color - Primary button border
  • --fc-button-text-color - Primary button text
  • --fc-button-hover-bg-color - Primary button hover background
  • --fc-button-hover-border-color - Primary button hover border
  • --fc-button-hover-text-color - Primary button hover text
  • --fc-button-active-bg-color - Primary button active background
  • --fc-button-secondary-bg-color - Secondary button background
  • And more...

Calendar Variables

  • --fc-page-bg-color - Calendar background
  • --fc-border-color - Calendar borders
  • --fc-today-bg-color - Today highlight background
  • --fc-event-bg-color - Event background
  • --fc-link-color - Link color
  • And more...

SharePoint Palette Variables

All SharePoint palette colors are available:

  • --fc-sp-theme-primary
  • --fc-sp-theme-dark
  • --fc-sp-neutral-lighter
  • etc.

TypeScript Support

Full TypeScript definitions are included:

import type { 
  IReadonlyTheme, 
  IPalette, 
  ISemanticColors,
  FullCalendarThemeOptions 
} from 'fullcalendar-spotheme';

CSS Import

Import the CSS file in your component or web part:

import 'fullcalendar-spotheme/dist/fullcalendar-theme.css';

Or import in your SCSS:

@import '~fullcalendar-spotheme/dist/fullcalendar-theme.css';

Examples

Handling Theme Changes

// Listen to theme changes in SPFx
protected onThemeChanged(currentTheme: IReadonlyTheme): void {
  if (this.themeController) {
    this.themeController.update(currentTheme);
  }
}

Custom Event Colors

While the library applies default theme colors to events, you can still customize individual events:

events={[
  { 
    title: 'Important Meeting', 
    date: '2026-01-15',
    backgroundColor: spTheme.palette.red,
    borderColor: spTheme.palette.redDark
  }
]}

Browser Support

  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • IE11 not supported (FullCalendar v6 requirement)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you encounter any issues or have questions, please file an issue on GitHub.

Changelog

1.0.0

  • Initial release
  • SharePoint theme integration
  • FullCalendar button styling
  • TypeScript support
  • Fluent UI design language