Skip to content

Commit 7afb9c9

Browse files
committed
color finished and on game settings
1 parent 6a5105c commit 7afb9c9

4 files changed

Lines changed: 89 additions & 19 deletions

File tree

scripts/settings.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MODULE_ID } from "./config.js";
1+
import { MODULE_ID, STICKY_TINTS, INK_COLORS } from "./config.js";
22

33
export const registerSettings = function() {
44

@@ -223,4 +223,30 @@ export const registerSettings = function() {
223223
type: Boolean,
224224
default: true
225225
});
226+
227+
game.settings.register(MODULE_ID, "defaultNoteColor", {
228+
name: "Default Note Color (Sticky)",
229+
hint: "The default color for newly created sticky notes.",
230+
scope: "client",
231+
config: true,
232+
type: String,
233+
choices: Object.keys(STICKY_TINTS).reduce((acc, key) => {
234+
acc[STICKY_TINTS[key]] = key.charAt(0).toUpperCase() + key.slice(1);
235+
return acc;
236+
}, {}),
237+
default: "#ffffff"
238+
});
239+
240+
game.settings.register(MODULE_ID, "defaultInkColor", {
241+
name: "Default Ink Color",
242+
hint: "The default ink color for text on newly created notes.",
243+
scope: "client",
244+
config: true,
245+
type: String,
246+
choices: Object.keys(INK_COLORS).reduce((acc, key) => {
247+
acc[INK_COLORS[key]] = key.charAt(0).toUpperCase() + key.slice(1);
248+
return acc;
249+
}, {}),
250+
default: "#000000"
251+
});
226252
};

scripts/utils/creation-utils.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ export async function createNote(noteType, { x = null, y = null } = {}) {
7474
: (game.settings.get(MODULE_ID, `${noteType}NoteDefaultText`) || "Notes");
7575

7676
const extraFlags = {};
77+
78+
// Apply default colors from settings
79+
if (noteType !== "handout" && noteType !== "pin") {
80+
extraFlags.tint = game.settings.get(MODULE_ID, "defaultNoteColor") || "#ffffff";
81+
extraFlags.textColor = game.settings.get(MODULE_ID, "defaultInkColor") || "#000000";
82+
}
83+
7784
// Set default font size to 9 for index cards
7885
if (noteType === "index") {
7986
extraFlags.fontSize = 9;
@@ -164,6 +171,7 @@ export async function createPhotoNoteFromActor(actor, isUnknown = false) {
164171
const imagePath = actor.img || "modules/investigation-board/assets/placeholder.webp";
165172
const extraFlags = {
166173
image: imagePath,
174+
textColor: game.settings.get(MODULE_ID, "defaultInkColor") || "#000000",
167175
...(isUnknown ? { unknown: true } : {})
168176
};
169177

@@ -232,7 +240,10 @@ export async function createPhotoNoteFromScene(targetScene) {
232240
const displayName = targetScene.navName || targetScene.name || "Unknown Location";
233241
const imagePath = targetScene.background?.src || "modules/investigation-board/assets/placeholder.webp";
234242

235-
const extraFlags = { image: imagePath };
243+
const extraFlags = {
244+
image: imagePath,
245+
textColor: game.settings.get(MODULE_ID, "defaultInkColor") || "#000000"
246+
};
236247

237248
const created = await collaborativeCreate({
238249
type: "r",
@@ -427,7 +438,10 @@ export async function createPhotoNoteFromItem(item) {
427438
const displayName = item.name || "Unknown Item";
428439
const imagePath = item.img || "modules/investigation-board/assets/placeholder.webp";
429440

430-
const extraFlags = { image: imagePath };
441+
const extraFlags = {
442+
image: imagePath,
443+
textColor: game.settings.get(MODULE_ID, "defaultInkColor") || "#000000"
444+
};
431445

432446
const created = await collaborativeCreate({
433447
type: "r",
@@ -565,14 +579,19 @@ export async function importFolderAsNotes(folder) {
565579
const y = startY + row * (height + spacing);
566580

567581
let noteData = null;
582+
const defaultTint = game.settings.get(MODULE_ID, "defaultNoteColor") || "#ffffff";
583+
const defaultInk = game.settings.get(MODULE_ID, "defaultInkColor") || "#000000";
584+
568585
if (type === "Actor") {
569586
const displayName = getActorDisplayName(doc);
570587
const imagePath = doc.img || "modules/investigation-board/assets/placeholder.webp";
571588
noteData = {
572589
type: "photo",
573590
text: displayName,
574591
linkedObject: `@UUID[${doc.uuid}]{${displayName}}`,
575-
image: imagePath
592+
image: imagePath,
593+
textColor: defaultInk,
594+
tint: "#ffffff"
576595
};
577596
} else if (type === "Item") {
578597
const displayName = doc.name || "Unknown Item";
@@ -581,7 +600,9 @@ export async function importFolderAsNotes(folder) {
581600
type: "photo",
582601
text: displayName,
583602
linkedObject: `@UUID[${doc.uuid}]{${displayName}}`,
584-
image: imagePath
603+
image: imagePath,
604+
textColor: defaultInk,
605+
tint: "#ffffff"
585606
};
586607
} else if (type === "Scene") {
587608
const displayName = doc.navName || doc.name || "Unknown Location";
@@ -590,7 +611,9 @@ export async function importFolderAsNotes(folder) {
590611
type: "photo",
591612
text: displayName,
592613
linkedObject: `@UUID[${doc.uuid}]{${displayName}}`,
593-
image: imagePath
614+
image: imagePath,
615+
textColor: defaultInk,
616+
tint: "#ffffff"
594617
};
595618
} else if (type === "Playlist") { // doc is a PlaylistSound
596619
const imagePath = cassetteImages[i % cassetteImages.length];
@@ -600,7 +623,8 @@ export async function importFolderAsNotes(folder) {
600623
image: imagePath,
601624
audioPath: doc.path,
602625
linkedObject: `@UUID[${doc.uuid}]{${doc.name}}`,
603-
audioEffectEnabled: applyLoFi
626+
audioEffectEnabled: applyLoFi,
627+
textColor: defaultInk
604628
};
605629
}
606630

@@ -694,6 +718,8 @@ export async function importPlaylistAsNotes(playlist) {
694718
cassetteImages.push(await _getRandomCassetteImage());
695719
}
696720

721+
const defaultInk = game.settings.get(MODULE_ID, "defaultInkColor") || "#000000";
722+
697723
for (let i = 0; i < documents.length; i++) {
698724
const doc = documents[i];
699725
const col = i % cols;
@@ -709,7 +735,8 @@ export async function importPlaylistAsNotes(playlist) {
709735
image: imagePath,
710736
audioPath: doc.path,
711737
linkedObject: `@UUID[${doc.uuid}]{${doc.name}}`,
712-
audioEffectEnabled: applyLoFi
738+
audioEffectEnabled: applyLoFi,
739+
textColor: defaultInk
713740
};
714741

715742
createDataArray.push({

styles/style.css

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,19 +1013,35 @@ body.investigation-board-mode .drawing:not([data-investigation-note="true"]) {
10131013
color: #f0f0e0 !important;
10141014
}
10151015

1016-
.sticky-tint-layer {
1016+
/* Sticky note tinting in preview */
1017+
.sticky-paper-container {
10171018
position: absolute;
10181019
inset: 0;
1019-
background-color: var(--sticky-tint, #ffffff);
1020+
display: flex;
1021+
align-items: center;
1022+
justify-content: center;
10201023
z-index: 1;
10211024
}
10221025

1023-
.sticky-tint-layer img {
1024-
width: 100%;
1025-
height: 100%;
1026-
object-fit: contain;
1027-
mix-blend-mode: multiply;
1026+
.sticky-tint-mask {
1027+
position: relative;
1028+
display: inline-block;
1029+
background-color: var(--sticky-tint, #ffffff);
1030+
-webkit-mask-size: contain;
1031+
-webkit-mask-repeat: no-repeat;
1032+
-webkit-mask-position: center;
1033+
mask-size: contain;
1034+
mask-repeat: no-repeat;
1035+
mask-position: center;
1036+
filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
1037+
}
1038+
1039+
.sticky-texture-overlay {
10281040
display: block;
1041+
max-width: 100%;
1042+
max-height: 70vh;
1043+
mix-blend-mode: multiply;
1044+
pointer-events: none;
10291045
}
10301046

10311047
.preview-text-container.has-background {

templates/note-preview.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@
5353
{{/if}}
5454

5555
{{#if showSeparateText}}
56-
<div class="preview-text-container {{fontClass}} {{#if backgroundPath}}has-background{{/if}} {{#if (eq noteType "sticky")}}sticky-note-tinted{{/if}}"
57-
style="{{#if (eq noteType "sticky")}}--sticky-tint: {{tint}};{{/if}}">
56+
<div class="preview-text-container {{fontClass}} {{#if backgroundPath}}has-background{{/if}}">
5857
{{#if backgroundPath}}
5958
{{#if (eq noteType "sticky")}}
60-
<div class="sticky-tint-layer">
61-
<img src="{{backgroundPath}}" alt="Background" />
59+
<div class="sticky-paper-container">
60+
<div class="sticky-tint-mask" style="background-color: {{tint}}; -webkit-mask-image: url('{{backgroundPath}}'); mask-image: url('{{backgroundPath}}'); --sticky-tint: {{tint}};">
61+
<img src="{{backgroundPath}}" class="sticky-texture-overlay" alt="Sticky Note Texture" />
62+
</div>
6263
</div>
6364
{{else}}
6465
<img src="{{backgroundPath}}" class="preview-background-img" alt="Background" />

0 commit comments

Comments
 (0)