cursor-utilities
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Cursor Utilities

Create CUR File from Canvas

To create a custom cursor for use in any modern browser (Chrome, Firefox, Edge), create a canvas with a dimension of 16x16, 32x32, or 64x64 pixels and then:

// call the `curObjectURLFromCanvas` function to retrieve an object URL pointing to a `CUR` file containing the canvas' image
const cursorObjectURL = curObjectURLFromCanvas(canvas);
 
// Use this URL in your inline style (or in a programatically created `StyleSheet`)
body.style.cursor = `url(${cursorObjectURL}), pointer`;

/cursor-utilities/

    Package Sidebar

    Install

    npm i cursor-utilities

    Weekly Downloads

    4

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    15.3 kB

    Total Files

    14

    Last publish

    Collaborators

    • timm