![]() |
|
Update Code Box language support - Printable Version +- bigpete.net (https://test.bigpete.net) +-- Forum: Meta (https://test.bigpete.net/forumdisplay.php?fid=15) +--- Forum: Dev Log (https://test.bigpete.net/forumdisplay.php?fid=18) +--- Thread: Update Code Box language support (/showthread.php?tid=46) Pages:
1
2
|
Update Code Box language support - BigPete - 02-26-2026 Going to add a few more languages to the code box since we'll probably be posting some code snippets here from time to time. Update Code Box language support - BigPete - 02-26-2026 BASH has been added [CODE=bash]d() { if [ $(( $1 * $1 + $2 * $2 )) -gt 5000000 ] || [ $5 -ge $6 ]; then echo "$5" else r=$(( ($1 * $1) / 100 - ($2 * $2) / 100 + $3 )) i=$(( ($1 * $2) / 100 * 2 + $4 )) c=$(( $5 + 1 )) d "$r" "$i" "$3" "$4" "$c" "$6" fi } g=(00 11 ,, .. ยทยท -- ++ '**' %% ^^) for y in {-25..25}; do for x in $(eval "echo {-$(( (${COLUMNS:-80} / 4) + 4 ))..$(( (${COLUMNS:-80} / 4) - 6 ))}"); do j=$(( x * 5 )) k=$(( y * 5 )) v=$(d "$j" "$k" "$j" "$k" 1 10) if [ "$v" -eq 10 ]; then echo -n " " else echo -n "${g[v]}" fi done echo done[/CODE] Update Code Box language support - BigPete - 02-26-2026 Hrmm. not optimal. I'll see if I can find a better formatter or update this one. Update Code Box language support - BigPete - 02-26-2026 BigPete, post: 2269863, member: 4840 Wrote:Hrmm. not optimal. I'll see if I can find a better formatter or update this one.integrated highlight.js. Seems better though the white background buurrrnns Update Code Box language support - BigPete - 02-26-2026 BigPete, post: 2269865, member: 4840 Wrote:integrated highlight.js. messing with some different themes until i find one that I like Update Code Box language support - BigPete - 02-26-2026 i'll go with that one for now. Update Code Box language support - Jim Rockford - 02-26-2026 That one looks nicer than stock konsole or kwrite/kate Update Code Box language support - BigPete - 02-26-2026 test javascript/typescript Code: import { createTheme } from '@vanilla-extract/css';
import { color } from 'folds';
export const silverTheme = createTheme(color, {
Background: {
Container: '#DEDEDE',
ContainerHover: '#D3D3D3',
ContainerActive: '#C7C7C7',
ContainerLine: '#BBBBBB',
OnContainer: '#000000',
},
Surface: {
Container: '#EAEAEA',
ContainerHover: '#DEDEDE',
ContainerActive: '#D3D3D3',
ContainerLine: '#C7C7C7',
OnContainer: '#000000',
},
SurfaceVariant: {
Container: '#DEDEDE',
ContainerHover: '#D3D3D3',
ContainerActive: '#C7C7C7',
ContainerLine: '#BBBBBB',
OnContainer: '#000000',
},
Primary: {
Main: '#1245A8',
MainHover: '#103E97',
MainActive: '#0F3B8F',
MainLine: '#0E3786',
OnMain: '#FFFFFF',
Container: '#C4D0E9',
ContainerHover: '#B8C7E5',
ContainerActive: '#ACBEE1',
ContainerLine: '#A0B5DC',
OnContainer: '#0D3076',
},
Secondary: {
Main: '#000000',
MainHover: '#171717',
MainActive: '#232323',
MainLine: '#2F2F2F',
OnMain: '#EAEAEA',
Container: '#C7C7C7',
ContainerHover: '#BBBBBB',
ContainerActive: '#AFAFAF',
ContainerLine: '#A4A4A4',
OnContainer: '#0C0C0C',
},
Success: {
Main: '#017343',
MainHover: '#01683C',
MainActive: '#016239',
MainLine: '#015C36',
OnMain: '#FFFFFF',
Container: '#BFDCD0',
ContainerHover: '#B3D5C7',
ContainerActive: '#A6CEBD',
ContainerLine: '#99C7B4',
OnContainer: '#01512F',
},
Warning: {
Main: '#864300',
MainHover: '#793C00',
MainActive: '#723900',
MainLine: '#6B3600',
OnMain: '#FFFFFF',
Container: '#E1D0BF',
ContainerHover: '#DBC7B2',
ContainerActive: '#D5BDA6',
ContainerLine: '#CFB499',
OnContainer: '#5E2F00',
},
Critical: {
Main: '#9D0F0F',
MainHover: '#8D0E0E',
MainActive: '#850D0D',
MainLine: '#7E0C0C',
OnMain: '#FFFFFF',
Container: '#E7C3C3',
ContainerHover: '#E2B7B7',
ContainerActive: '#DDABAB',
ContainerLine: '#D89F9F',
OnContainer: '#6E0B0B',
},
Other: {
FocusRing: 'rgba(0 0 0 / 50%)',
Shadow: 'rgba(0 0 0 / 20%)',
Overlay: 'rgba(0 0 0 / 50%)',
},
});
const darkThemeData = {
Background: {
Container: '#1A1A1A',
ContainerHover: '#262626',
ContainerActive: '#333333',
ContainerLine: '#404040',
OnContainer: '#F2F2F2',
},
Surface: {
Container: '#262626',
ContainerHover: '#333333',
ContainerActive: '#404040',
ContainerLine: '#4D4D4D',
OnContainer: '#F2F2F2',
},
SurfaceVariant: {
Container: '#333333',
ContainerHover: '#404040',
ContainerActive: '#4D4D4D',
ContainerLine: '#595959',
OnContainer: '#F2F2F2',
},
Primary: {
Main: '#BDB6EC',
MainHover: '#B2AAE9',
MainActive: '#ADA3E8',
MainLine: '#A79DE6',
OnMain: '#2C2843',
Container: '#413C65',
ContainerHover: '#494370',
ContainerActive: '#50497B',
ContainerLine: '#575086',
OnContainer: '#E3E1F7',
},
Secondary: {
Main: '#FFFFFF',
MainHover: '#E5E5E5',
MainActive: '#D9D9D9',
MainLine: '#CCCCCC',
OnMain: '#1A1A1A',
Container: '#404040',
ContainerHover: '#4D4D4D',
ContainerActive: '#595959',
ContainerLine: '#666666',
OnContainer: '#F2F2F2',
},
Success: {
Main: '#85E0BA',
MainHover: '#70DBAF',
MainActive: '#66D9A9',
MainLine: '#5CD6A3',
OnMain: '#0F3D2A',
Container: '#175C3F',
ContainerHover: '#1A6646',
ContainerActive: '#1C704D',
ContainerLine: '#1F7A54',
OnContainer: '#CCF2E2',
},
Warning: {
Main: '#E3BA91',
MainHover: '#DFAF7E',
MainActive: '#DDA975',
MainLine: '#DAA36C',
OnMain: '#3F2A15',
Container: '#5E3F20',
ContainerHover: '#694624',
ContainerActive: '#734D27',
ContainerLine: '#7D542B',
OnContainer: '#F3E2D1',
},
Critical: {
Main: '#E69D9D',
MainHover: '#E28D8D',
MainActive: '#E08585',
MainLine: '#DE7D7D',
OnMain: '#401C1C',
Container: '#602929',
ContainerHover: '#6B2E2E',
ContainerActive: '#763333',
ContainerLine: '#803737',
OnContainer: '#F5D6D6',
},
Other: {
FocusRing: 'rgba(255, 255, 255, 0.5)',
Shadow: 'rgba(0, 0, 0, 1)',
Overlay: 'rgba(0, 0, 0, 0.8)',
},
};
export const darkTheme = createTheme(color, darkThemeData);
export const butterTheme = createTheme(color, {
...darkThemeData,
Background: {
Container: '#1A1916',
ContainerHover: '#262621',
ContainerActive: '#33322C',
ContainerLine: '#403F38',
OnContainer: '#FFFBDE',
},
Surface: {
Container: '#262621',
ContainerHover: '#33322C',
ContainerActive: '#403F38',
ContainerLine: '#4D4B43',
OnContainer: '#FFFBDE',
},
SurfaceVariant: {
Container: '#33322C',
ContainerHover: '#403F38',
ContainerActive: '#4D4B43',
ContainerLine: '#59584E',
OnContainer: '#FFFBDE',
},
Secondary: {
Main: '#FFFBDE',
MainHover: '#E5E2C8',
MainActive: '#D9D5BD',
MainLine: '#CCC9B2',
OnMain: '#1A1916',
Container: '#403F38',
ContainerHover: '#4D4B43',
ContainerActive: '#59584E',
ContainerLine: '#666459',
OnContainer: '#F2EED3',
},
});Update Code Box language support - BigPete - 02-26-2026 okay, so there's an autodetect for supported languages, however it doesn't seem to work right away? Like on post it shows uncolored code, but on refresh it then applies. investigating... Update Code Box language support - BigPete - 02-26-2026 BigPete, post: 2269877, member: 4840 Wrote:okay, so there's an autodetect for supported languages, however it doesn't seem to work right away? Like on post it shows uncolored code, but on refresh it then applies.nvm that was my bad. should be fixed now. So.. I think autodetect should work for the following languages: 0: "bash" 1: "c" 2: "cpp" 3: "csharp" 4: "css" 5: "diff" 6: "go" 7: "graphql" 8: "ini" 9: "java" 10: "javascript" 11: "json" 12: "kotlin" 13: "less" 14: "lua" 15: "makefile" 16: "markdown" 17: "objectivec" 18: "perl" 19: "php" 20: "php-template" 21: "plaintext" 22: "python" 23: "python-repl" 24: "r" 25: "ruby" 26: "rust" 27: "scss" 28: "shell" 29: "sql" 30: "swift" 31: "typescript" 32: "vbnet" 33: "wasm" 34: "xml" 35: "yaml" to use click the insert button (+) and then select "code" Select "General Code" for autodetect I will probably remove BASH, PHP, and C# from the drop down as they should be handled automatically. paste your code in and then click insert. Let me know if there's issues. |