You can change the text- and background color of the table.
Set a text- and background color for the body content.
import { Table } from 'voici.js'
const data = [
{ firstname: 'Homer', lastname: 'Simpson', age: 39 },
{ firstname: 'Marge', lastname: 'Simpson', age: 36 },
{ firstname: 'Bart', lastname: 'Simpson', age: 10 },
{ firstname: 'Lisa', lastname: 'Simpson', age: 8 },
{ firstname: 'Maggie', lastname: 'Simpson', age: 1 }
];
const config = {
body: {
bgColor: '#6184D8',
textColor: '#d8b561'
}
};
const table = new Table(data, config);
table.print();
Set a text- and background color for the header content.
import { Table } from 'voici.js'
const data = [
{ firstname: 'Homer', lastname: 'Simpson', age: 39 },
{ firstname: 'Marge', lastname: 'Simpson', age: 36 },
{ firstname: 'Bart', lastname: 'Simpson', age: 10 },
{ firstname: 'Lisa', lastname: 'Simpson', age: 8 },
{ firstname: 'Maggie', lastname: 'Simpson', age: 1 }
];
const config = {
header: {
bgColor: '#6184D8',
textColor: '#d8b561'
}
};
const table = new Table(data, config);
table.print();
Set a background color columns by column.
import { Table } from 'voici.js'
const data = [
{ firstname: 'Homer', lastname: 'Simpson', age: 39 },
{ firstname: 'Marge', lastname: 'Simpson', age: 36 },
{ firstname: 'Bart', lastname: 'Simpson', age: 10 },
{ firstname: 'Lisa', lastname: 'Simpson', age: 8 },
{ firstname: 'Maggie', lastname: 'Simpson', age: 1 }
];
const config = {
bgColorColumns: ['#DF3B57', '#0F7173']
};
const table = new Table(data, config);
table.print();