Have a look at the attributes. GDAL can read the styles from DXF:
ogrinfo jcsample.dxf -al
INFO: Open of `jcsample.dxf'
using driver `DXF' successful.
Layer name: entities
Geometry: Unknown (any)
Feature Count: 4036
Extent: (-174.786500, -1163.622000) - (1769.214000, 204.378100)
Layer SRS WKT:
(unknown)
Layer: String (0.0)
SubClasses: String (0.0)
ExtendedEntity: String (0.0)
Linetype: String (0.0)
EntityHandle: String (0.0)
Text: String (0.0)
OGRFeature(entities):0
Layer (String) = PAPER
SubClasses (String) = (null)
ExtendedEntity (String) = (null)
Linetype (String) = CONTINUOUS
EntityHandle (String) = (null)
Text (String) = (null)
Style = PEN(c:#00ffff,p:"1.0g")
LINESTRING (1644.348 -1051.956 0,1763.214 -1051.956 0)
However, styles are not written into GeoJSON automatically but you can do it with the -sql parameter:
ogr2ogr -f geojson -dialect sqlite -sql "select geometry, ogr_style from entities" style.json jcsample.dxf
Check the result:
ogrinfo style.json -ro -al
INFO: Open of `style.json'
using driver `GeoJSON' successful.
Layer name: OGRGeoJSON
Geometry: Unknown (any)
Feature Count: 4036
Extent: (-174.786500, -1163.622000) - (1769.214000, 204.378100)
Layer SRS WKT:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]
OGR_STYLE: String (0.0)
OGRFeature(OGRGeoJSON):0
OGR_STYLE (String) = PEN(c:#00ffff,p:"1.0g")
Style = PEN(c:#00ffff,p:"1.0g")
LINESTRING (1644.348 -1051.956 0,1763.214 -1051.956 0)
It is somehow odd that now Style goes both into OGR_STYLE and into Style, but at least you can get those. OGR_STYLE is documented in http://www.gdal.org/ogr_feature_style.html.
Best Answer
I ended up making a node.js script which uses ogr2ogr through the command line.
It calls ogr2ogr through a spawned child process to keep it async.
Then it reads the new geoJSON file into node, groups features in featureCollection by Layer name, wraps each group into a geoJSON container, and writes each wrapped group to a separate ".json" file.
Code is available here