Skip to content

Instantly share code, notes, and snippets.

@XCompWiz
XCompWiz / google-sheets-colour-preview.js
Last active March 10, 2022 04:22 — forked from Pathoschild/google-sheets-color-preview.js
A Google Sheets script which adds colour preview to cells. When you edit a cell containing a valid CSS hexadecimal colour code (like #000 or #000000), the background colour will be changed to that colour and the font colour will be changed to the inverse colour for readability.
/*
This script is meant to be used with a Google Sheets spreadsheet. When you edit a cell containing a
valid CSS hexadecimal colour code (like #000 or #000000), the background colour will be changed to
that colour and the font colour will be changed to the inverse colour for readability.
To use this script in a Google Sheets spreadsheet:
1. go to Tools » Script Editor » Spreadsheet;
2. erase everything in the text editor;
3. change the title to "Set colour preview on edit";
@XCompWiz
XCompWiz / gist:3766703
Created September 22, 2012 16:43
Basic onWorldLoad get world filedir
@ForgeSubscribe
public void worldLoadEvent(Load event) {
getWorldDir(event.world);
}
private File getWorldDir(World world) {
String str = ""; //FIXME: Get base directory (using
str = str + world.getSaveHandler().getSaveDirectoryName();
if (world.provider.getSaveFolder() != null) {
str = str + world.provider.getSaveFolder();