Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
minecraft-codes
Advanced tools
This library can help you convert colored messages (strings) from minecraft to javascript described objects
If you wanted once to convert colored server name or some other minecraft colored string in JavaScript, you may be met failure. This library can help you create objects from colored strings to data objects, which you can use for render this colored strings!
npm i minecraft-codes
Or
yarn add minecraft-codes
This is how u can use this library
const {getColoredStringData, getColorTag, getColorName} = require('minecraft-codes');
getColoredStringData("&aLast&bCraft").forEach(word => {
console.log(word.color) // light-green and water
console.log(getColorTag(word.color)) //&a and &b
console.log(word.color === getColorName(getColorTag(word.color))) // true true
console.log(word.value) // "Last" and "Craft"
})
getColoredStringData("&c&k| &l&r&aLast&eCraft")
/*
[ { value: '| ',
isObfuscate: true,
isUnderline: false,
isLineThrough: false,
isItalic: false,
isBold: false,
color: 'scarlet' },
{ value: '',
isObfuscate: false,
isUnderline: false,
isLineThrough: false,
isItalic: false,
isBold: false,
color: 'alpha' },
{ value: 'Last',
color: 'light-green',
isObfuscate: false,
isUnderline: false,
isLineThrough: false,
isItalic: false,
isBold: false },
{ value: 'Craft',
color: 'yellow',
isObfuscate: false,
isUnderline: false,
isLineThrough: false,
isItalic: false,
isBold: false } ]
*/
Return color name by color
value
const {getColorName} = require('minecraft-codes');
console.log(getColorName("&0")); // black
console.log(getColorName("&f")); // white
console.log(getColorName("&r")); // reset
console.log(getColorName("&k")); // alpha
black, blue, green, emerald, red, purple, orange, gray, space-gray, water, light-green, diamond, scarlet, pink, yellow, white
You can use it anywhere where you need render minecraft colored string in JavaScript code. For example, i used it my React application that show colored server name in list of servers!
Love Minecraft, guys!
FAQs
This library can help you convert colored messages (strings) from minecraft to javascript described objects
The npm package minecraft-codes receives a total of 1 weekly downloads. As such, minecraft-codes popularity was classified as not popular.
We found that minecraft-codes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.