ken_nogi/pleasanter/develop/なないろケアプランセンター/6.カテゴリ管理/色見本,js
Kenichiro NOGI 48d993652f 20251006
2025-10-06 09:23:38 +09:00

59 lines
1.5 KiB
Plaintext

// ...existing code...
// パステルカラー英語名リスト
const pastelColors = [
"Red",
"SkyBlue",
"Yellow",
"LightGreen",
"Cyan",
"Magenta",
"Orange",
];
// テーブル生成関数
function createPastelColorTable() {
let table = document.createElement('table');
table.style.borderCollapse = 'collapse';
table.style.margin = '20px';
table.style.width = '100px';
pastelColors.forEach(colorName => {
let tr = document.createElement('tr');
let td = document.createElement('td');
td.textContent = colorName;
td.style.backgroundColor = colorName;
td.style.color = '#333';
td.style.padding = '8px 24px';
td.style.border = '1px solid #ccc';
td.style.fontWeight = 'bold';
tr.appendChild(td);
table.appendChild(tr);
});
const commentField = document.getElementById('CommentField');
if (commentField) {
commentField.innerHTML = '';
commentField.appendChild(table);
} else {
document.body.appendChild(table);
}
const resultsClassC = $('#Results_ClassC').val();
if (resultsClassC) {
const colorValue = resultsClassC.trim();
$('#Results_ClassC').css('background-color', colorValue);
}
}
// ページロード時にテーブルを表示
window.addEventListener('load', createPastelColorTable);
$p.events.after_set = function (args) {
//処理内容
createPastelColorTable();
}