Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

This is unofficial NodeJs (JavaScript) API for ray.so that turns your code into beautiful images. Choose from a range of syntax colors, hide or show the background, and toggle between a dark and light window.

License

NotificationsYou must be signed in to change notification settings

akashrchandran/rayso

Repository files navigation

versiondownloadsauthor on telegram

logotype

This is unofficial NodeJs (JavaScript) API forray.so that turns your code into beautiful images. Choose from a range of syntax colors, hide or show the background, and toggle between a dark and light window.

Note

This is a fork of the projectrayso-api developed bys0ftik3, which is no longer maintained. I have updated the project to work with the latest version of the ray.so.

Navigation

Installing

$ npm i rayso

Usage

importRaySofrom'rayso'constraySo=newRaySo({// parameters, if you want to customize the output// you'll find detailed info about parameters below})raySo.cook(`console.log('Hello, World!');`).then(response=>{// response is image buffer}).catch(err=>{console.error(err)})
importRaySofrom'rayso'constraySo=newRaySo()

Parameters

ParameterDefault valueTypeDescription
title"Untitled-1"StringThe title will be displayed on top of the code box.
theme"breeze"StringThere are several options of how your box will look like. Available themes: breeze, candy, crimson, falcon, meadow, midnight, raindrop, sunset
backgroundtrueBooleanIf disabled, it will create an image of code box only, without background.
darkModetrueBooleanIf disabled, it will change your theme to its light version.
padding32String or NumberDistance between borders and code box. Available values: 16, 32, 64 and 128.
language"auto"StringYou better leave it auto :/ However, you can try to pass some language name and if it worked, good for you!
localPreviewfalseBooleanIf enabled, it will create example.png image file of the output in the current directory.
localPreviewPathcurrent directoryStringPath to create example files. MacOS, Linux and Windows paths supported.
debugfalseBooleanIf enabled, it will show messages in the console during code execution.

Examples

Default output

importRaySofrom'rayso'constraySo=newRaySo()

output

Custom parameters

importRaySo,{CardTheme,CardPadding,CardProgrammingLanguage,}from'rayso'constraySo=newRaySo({title:'Custom Title',theme:CardTheme.CANDY,padding:CardPadding.md,language:CardProgrammingLanguage.JS,debug:true,localPreview:true,localPreviewPath:'/Users/akashrchandran/rayso_screenshots',})

output

Output without background

importRaySofrom'rayso'constraySo=newRaySo({background:false})

output

Themes

These are all the available themes, so far. As soon Ray.So has a new theme, it will appear here. Default themebreeze is not listed here, you saw it in the first picture of this README.

Breeze

importRaySofrom'rayso'constraySo=newRaySo({theme:'breeze'})

breeze

Mono

importRaySofrom'rayso'constraySo=newRaySo({theme:'mono'})

mono

Candy

importRaySofrom'rayso'constraySo=newRaySo({theme:'candy'})

candy

Crimson

importRaySofrom'rayso'constraySo=newRaySo({theme:'crimson'})

crimson

Falcon

importRaySofrom'rayso'constraySo=newRaySo({theme:'falcon'})

falcon

Meadow

importRaySofrom'rayso'constraySo=newRaySo({theme:'meadow'})

meadow

Midnight

importRaySofrom'rayso'constraySo=newRaySo({theme:'midnight'})

midnight

Raindrop

importRaySofrom'rayso'constraySo=newRaySo({theme:'raindrop'})

raindrop

Sunset

importRaySofrom'rayso'constraySo=newRaySo({theme:'sunset'})

sunset

Note

There are more themes available, please checkoption.js file to see the entire list.

Credits

About

This is unofficial NodeJs (JavaScript) API for ray.so that turns your code into beautiful images. Choose from a range of syntax colors, hide or show the background, and toggle between a dark and light window.

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp